For me, asking whether I had a husband would have been a red flag. Even if someone seems to be “just being friendly” and even if you think it’s part of their job, a question regarding relationship status from any man is almost certainly predatory.
I think I might have responded at that point with “Why do you want to know?” assuming I was mentally prepared. You say you normally lie, but doesn’t it make you uncomfortable that you feel you have to do so?
You can’t change other people’s actions, and it sounds like this might be something that happens again. The outcome here was negative - you felt awkward and now probably don’t want to go back there. So think carefully through your own reactions and whether there’s a way you might have handled it that would have left you feeling better about the way you handled it, even if you left thinking he was an asshole. With hindsight, were there any other points where you might have deflected?
Then next time the opportunity comes up to say “no” where you are tempted to say yes, even though you’d rather say no (ideally in a less complicated situation) then take it as an opportunity to begin saying what you want to say, rather than what you feel you ought to.
If you can learn to do this, it’s very freeing. You won’t manage it all at once, so don’t beat yourself up. Maybe look for assertiveness courses, if you can find one that would fit (I realise it’s not easy as a single parent) but more generally, I think we women need to start to fight back against our socialisation. Men like the one you encountered are far too used to taking advantage.