No. An undercover cop is not required to tell you that he is a cop nor give you his badge number. In fact, depending on the agency, a uniformed officer may not be required to give you his badge number either. This is because for some agencies, badge numbers are meaningless.