One of my friends did this in our current campaign. The character was pretending to be a man because she was a bard on the run from a jarl who was trying to kill her for some unknown reason. We knew the character was running away from someone who wanted them
dead but never questioned it much.
In retrospect, my friend was dropping clues that something was amiss but we all didn't notice them. We never got a good look at the character sheet to see that the gender box was left blank.
The first clue that something was up was the general untalkative nature of the character. This character is a bard. I was expecting a more classical boisterous bard but the she really only would only play music, never sang, and didn't negotiate much for the party. I ended up doing a lot of the negotiation because I have the second highest charisma.
The baggy drab robe and gray hood were another indicator that something was under wraps. This is the first campaign the player has ever been in so I just figured they were doing the standard "I'm dark and cool" thing. Nope. She was actually hiding something and trying not to draw attention.
The last indicator was the denial of fanservice. We killed some high ranking chieftains, took over their tribe, and the DM threw the harem at us. One character always accepts the ladies so that was that. I'm a ghoul who is pretending to be human so I kicked them all out before anyone could find out. Our bard did the same. What kind of bard would deny a chance to be covered in hot women? A straight female bard that's who. From there some people started joking that the character must be gay. Joke's on us.
In short, yes you can pull it off. Just don't be a jerk about it. And be sure to drop hints and change a few mannerisms. Some people are sick of a person playing "bro but with tits".