Recruitment in an irregular situation of non-Community workers

What a company has to do if it has hired a foreigner, who at the time was authorized to work but is currently in an irregular situation in Spain due to expiration or non-renewal? At the time of hiring you must request the Identity card to verify the validity of the work permit. We are sometimes advised to include an …