Phenotype is simply how they look.
When defining the sex BY FACT you must "report the source with the highest authority" which in this case is someone's genotype.
Take the best example possible, a transgender.
If a man has transgender surgery and becomes a woman we refer to him as a woman. However, scientifically speaking, the man still has X and Y chromosomes which means he is in fact, still a man.