"She works in an office."
Translation:Zij werkt in een kantoor.
I think you have to learn. Often it will be bij, especially if it's referring to a company or institution, but there are some (common) exceptions that use op, if I'm not mistaken the ones using op usually refer to a building: op kantoor, op school, op het station, op de ambassade (building), bij de ambassade (institution), op de rechtbank (building), bij de rechtbank (institution) also some use op because it is some thing you literally are on top of: op de markt, op het land (usually if you're a farmer), op de bouwplaats.
BTW, you can also say Zij werkt op de bank and because of the 2 meanings of bank it can mean both that she's working at home on her couch and that she's working at the financial institution.
Thank you for the explanation. I think there is also a difference between Flemish and AN. One example that comes up often for me is 'op het station' vs. 'in het station'. I'm told that 'op het station' is strange in Flanders unless you are literally on top of the building, or maybe if its a rural train stop that only has a platform. In fact the children's song "op een kein stationetje" is "in een klein stationetje" (cf Flemish Musti videos on YouTube).
Yup, there are always these small differences between Dutch Dutch and Flemish. Another example of prepositions that are different (common on traffic signs): after 100 metres = over 100 meter (NL) = na/op 100 meter (BE) and for 100 metres = voor 100 meter (NL) = over 100 meter (BE).