When using mailboxes in O365 and using Directory Sync you can only hid a mailbox using the extended attributes in AD.
Get-ADUser test5|Set-ADObject -replace @{msExchHideFromAddressLists=$true}
Ref: https://medium.com/gitbit/hide-user-from-address-lists-ad-connect-ee67f2369bc1