Actually, it is quite frequent, when you are shopping, and a store worker addresses you to call you sir or ma'am because they have no way of knowing your name.
Exactly, that's what we do every day.
But like I said, it makes no logical sense (even in Starfleet) to call female superior officers "sir", because that word is inherently male. You wouldn't call male superiors "ma'am", so why call females "sir"?
Same goes for "Mister." That's also a male term. Why not just use the rank, if you're talking to a junior officer?