A better question is, why is the government administering it in the first place?
There should be no laws that depend on either gender or sex, so knowing it does not help the government fulfill its obligations. Therefore it is not covered by the public interest and official authority grounds of the GDPR.
That really depends on your jurisdiction. There are places where domestic partners have a different status. Mostly because of the long arm of the Catholic Church.
Nice “preventing”, loser.