Many big tech companies have inclusion training calling this question out as inappropriate on the grounds it provides an opportunity to introduce bias.
Sure, that's advised in interviews, where you're about to make a decision on someone's livelihood, hence the importance of reducing bias. That's a completely different context than in casual conversation at a social event.
In the same lines, don't ask anything. Everything is a bias. ie, What do they do? - Also a bias as they are engineer, or product, or sales, or whatever.