The rental property is private property and anyone can be told not to enter the private property.Usually the lease specifies rules regarding tenants and tenants' visitors. Visitors can come as they please but certain actions can result in the management prohibiting the visitors from entering the premises. Even the tenant who continues to have these prohibited visitors at their place can be evicted.But the reasons are usually for specific behaviors such as disturbing other tenants, making too much noise, disobeying property rules, etc. These actions are not necessarily unlawful.