Your bank has the ability to reject the funds (and some banks will allow you to broadly control deposits with a credit block).
Before posting funds to your account, a bank will scan the funds transfer against sanctions lists and only allow the deposit if there is no hit.