In this example, straight people don't have to lie about not being married just to shut down small talk. Instead they use short responses, avoid eye contact, and give off the general vibe that they're not in the mood to talk. But why can't gay people do the same?
It's not that it "surprises" a lot of people (although often enough it does), it's that they don't understand it and they don't agree with it, and many feel like their religious beliefs justify being vocal about it. Being trapped in a car with someone like this is uncomfortable, particularly when they could leave you stranded at the drop of a hat.
A friend was recently sexually assaulted by a cab driver who was out on bail and back to work the next day. It's naive to think that because of their job that they are any less prone to having an opinion and saying or doing something socially unacceptable because of it.
All taxi drivers I have known have met all kinds of somewhat crazy/scary people I would really have a hard time believing that a gay person would be the slightest bit controversial.
Of course there is always some risk but if it is large enough that you are seriously concerned about being randomly assaulted just for being gay you have probably chosen a bad place to live.
For example Muslims will not drink but almost every off license within a square mile of me is Muslim owned.
I don't hang around in typically "gay" circles or even know that many people in general but I know enough gay people that homosexuality is not surprising for me at all.
For the purposes of casual conversation with strangers, if someone asks about a wife surely it's simple enough to say "I'm not married" and allow them to assume whatever they like unless you feel like sharing more.