He wasn’t investigating her. If you are an undercover agent and meet someone new - off duty and unrelated to work - are you allowed to tell them your real name?
If not, if a single person is forced to choose between no intimate relationships and relationships only under a pseudonym, then the latter is the predictable choice.