Certain organisations can check it out with permission from the court Sometimes people could find out based on marriage documents which are not secret
Technically the information is only ever shared with those who seek permission from the court and this is not always successful.
For more information on the recording and accessibility of gender history see: https://www.justice.gov.uk/downloads/tribunals/gender-recognition-panel/overseas-application-process/explanatory-leaflet-guide-for-users.pdf
For more information on the above case see: https://www.belfasttelegraph.co.uk/news/northern-ireland/sex-change-northern-ireland-man-who-wed-woman-bids-to-keep-secret-his-gender-history-30965746.html
However, a case surfaced in Belfast in February 2015 in which a trans man is trying to have his civil partnership kept secret. The trans male recently married his wife and so could be outed as trans if anyone were to look into his previous partnership records which are available to the public. The case is ongoing.