I don't think there is a specific prohibition, but it might be difficult from a practical standpoint. It depends if the person is post-op or not; if someone was born a man, but now is physically a woman, I don't think that would be a problem at all as long as they had a way to provide for any medications or on-going treatments. If someone had a physically male body but identified as female, that would be a more complex issue.
Gain and loss, status and disgrace,
censure and praise, pleasure and pain:
these conditions among human beings are inconstant,
impermanent, subject to change.
Knowing this, the wise person, mindful,
ponders these changing conditions.
Desirable things don’t charm the mind,
undesirable ones bring no resistance.
His welcoming and rebelling are scattered,
gone to their end,
do not exist.
- Lokavipatti Sutta