When any real property is used or occupied in whole or in part as a bawdy-house, or house or place of assignation for lewd persons, or for purposes of prostitution, or for any illegal trade, business or manufacture, its use or occupancy could be illegal.
For Example, NY CLS RPAPL § 715 prescribes the grounds and procedure for the removal of persons whose use or occupancy of the real property is illegal.
When a building is occupied without receiving any approvals or permits, such an occupation could also be termed as illegal or unlawful.
NY CLS Mult D § 301 prescribes that no multiple dwelling shall be occupied in whole or in part until the issuance of a certificate by the department confirming the requirements of all applicable laws.
Any occupation of any dwelling or structure in violation of section 301 is unlawful. [NY CLS Mult D § 302]