Origins: Police don't have to reveal their status, even when asked flat out. There's nothing in the law to prohibit law enforcement officers from lying in the course of performing their duties. Were this not so, there'd be no sting operations that involve telling wanted criminals they'd just won trips to Bermudas to get them to come on in, or undercover operations where cops pretend to be suppliers to drug buyers. Police couldn't do their jobs were they restricted to telling the truth all of the time, and a moment's thought about it should lay this belief to rest.
It has long been accepted hooker lore that a working girl could render herself arrestproof by asking a prospective john if he were a policeman before anyone's clothes came off. This belief in protection rested on the notion that even if the client did turn out to be a cop, his not being truthful about it would get the arrest thrown on the grounds of entrapment.
Entrapment, alas, has to do with leading someone into engaging in an illegal activity he or she wouldn't otherwise have been involved in. A
Even so, this bit of hooker lore is widely believed, and reliance upon it gets a number of girls arrested who might otherwise have passed on the trick. In 1986 prostitute Dolores French and her lawyer husband Michael Hauptman wrote a legal pamphlet they planned to distribute nationwide to call girls through COYOTE (Call Off Your Old Tired Ethics), the national hookers' association, and AIDS test programs being conducted in several cities. Among other things, it warned that undercover police waving money have to go a long way to be accused of entrapping prostitutes. "Many people believe if you ask an officer if he is a cop, and the officer denies it, that is entrapment. This is a myth," the pamphlet said.
As for how the police view the question of telling the truth when confronted:
Sightings: In an episode of the television crime drama
Last updated: 7 June 2007
Bensman, Todd. "Monthlong Sting Operation Nabs People Accused of Soliciting Sex." The Dallas Morning News. 26 April 1996 (p. A38). McAfee, Cindy. "Legal Guide Advises Prostitutes How to Stay out of Jail." United Press International. 10 November 1986.