The short answer is that the defining requirement is to go undercover.
In practical terms, that means blending in and concealing your identity as a law enforcement officer so you can gather information or investigate without drawing attention. Beyond that, real undercover work also demands training, patience, and the ability to maintain your cover convincingly.