Yeah it's a commonly held misconception spanning decades that cops must identify themselves if asked. I wonder where it originated. Needs some sunlight like:
Badger: "Prove you're not a cop."
...
Undercover cop: "If you ask a cop if he's a cop, he's like... obligated to tell you -- it's in the Constitution."
- Breaking Bad, Season 2, Episode 8, moments before Badger gets arrested