I don’t know the official Catholic doctrine, but I am going out to supper in a few minutes with a transgender friend who has found the Catholic church to be very supportive.
A number of issues have been raised in this thread, and I will touch on several of them.
The church teaches that there are two genders; this is reflected in scripture (“male and female He created them”), however the church considers this to be a self-evident truth, easily observed.
The church teaches there is a spiritual distinction between the two, which manifests itself physically. Though equal in human dignity, men and women are distinct but complementary. It is their complementary natures that allow a man and women to marry. The most obvious evidence of a complementary nature is the ability to procreate; more abstractly are the elements of motherhood and fatherhood. Even if a married couple cannot procreate, the these elements can still be expressed. Thus marriage (and sex) is permitted among couples who are infertile.
Incidentally, marriage is considered to be intrinsic to human nature. Marriages between two non-Catholics are fully recognized as valid and sacred. The Catholic Church only regulates marriage among its members to help guide away them from sinning from entering invalid or potentially invalid marriages. Non-members, however, are free to make any good faith attempt marriage.
For most of recorded history, the physiological distinction between men and women were very poorly understood; external genitalia was was perhaps the best indicator. When genetics were discovered, it appeared there was a very clear answer: XX female; XY male. This however, is a matter of science, and the church has very little authority to interpret these matters. The Church roughly accepts the XX and XY definitions. The emerging science investing transgendered individuals, however, may reopen the definition. Some intersex individuals have “chimeric” genetic profiles; some portions of their bodies have XX genes, others XY. What gender do they belong to? Brain scans of some XY transwoman show activity more similar to the brain activity in XX woman than XY men. There may be other physiological indicators of male and female than pure genetics.
Thus “Male and Female He created them”, but what is “male and female”?
However, there are practical concerns. The Catholic Church teaches that priests have grace that allow them to forgive sins during the sacrament of confession. The also have grace that allows them to turn bread and wine sacramentally into the body and blood of God the Son, Jesus Christ.
Only men are able to be ordained priests according to Catholic teaching. The sacramental graces of the priesthood are taught to build upon the role of men as fathers. Thus a women cannot become a priest. As the science behind transgendered (XX) men is so poorly understood, the church would not accept them to the priesthood out of an abundance of caution. The graces of the priesthood are taught to help keep people out of Hell, and any chance that the priesthood would be invalid cannot be accepted.
However, the role of nuns and even munks does not have the same stakes. A transgendered individual, if of sufficient physical and mental health, could be permitted to enter a monastery with proper permission from the Pope and the monasteries leaders. A life of prayer many hours a day can be very difficult, so turning away a transgendered individual due to other factors, such as depression, would not be unjustly discriminatory.
Funerals, too, are considered a matter of basic human dignity. To turn away a deceased transgendered individual for solely the matter of his or her identity would be a disgrace of the highest order. Only reasons applicable to anybody, such as actively undermining the church during one’s life, could justify barring a funeral.
The Church considers its job to be getting people into Heaven, kicking and screaming if necessary. To do this, it must preach what it believes to be the truth. It also has wide discretion to be tolerant, if such tolerance and mercy might help save an individual’s soul. Transgender is a very poorly understood phenomenon. The science is rapidly changing. The men of cloth who run the church are slow and cautious about change. A few bad apples are truly bigoted.
The official position of the church towards the transgendered is caution.