So, you're a woman, out with your (male) long term partner. You happen to encounter someone (another man) who knows both of you, and has done tor a number of years, although neither you or your partner are particularly close to this man. You smile and say hello but the man only makes eye contact and speaks with your husband and doesn't acknowledge you at all.
This has also happened when I arranged for a landscaper to come and quote for some work. I arranged it, I met him at the front door and started to explain what I was looking to have done in the garden area. My husband joined us a while later and as soon as he did, the landscaper stopped talking to me altogether and only spoke to my husband.
After both of these incidents I was confused - my husband has social anxiety whereas I am confident and friendly and can chat to anyone.
Why do men do this? Is it because we women are lesser beings and not worthy of speaking to if a member greater male species are present? Grrr.