The question itself is NOT discrimatory, unless it is followed by a discriminatory act.
Thus, when is comes to marriage, to ask if one is male/female is not discriminatory, but to ask someone to PROVE that they are male or female for the purposes of performing or not performing a ceremony IS discriminatory, insofar as the male/female requirement in the marriage ceremony is ipso facto discriminatory. If it weren't discriminatory, there would be no need to ask for PROOF of male/female.