I realize your intentions are good but in many cases, this will produce the opposite result you intend. Perhaps some transgender people will answer the question and be grateful you asked it. But what that question implies is "It's not clear whether you are really a man or a woman, which is why I have to ask you what you are." I think most Transgender people will resent that implication. Of course, some transgender people will resent being misgendered, so you can't really win either way. That's what happens when the courtesies rules are being rewritten. No one really knows how to behave, and so everybody has to try their best to make it work..