The doors to buildings are not synchronised properly with the client. Sometimes they can be closed for the server and open for the client. If you try to loot the items inside you are unable to, because the server cannot recognise you inside a closed building.
To be synched with the servers door states, before you enter you can punch the outer walls of the buildings or open and close the doors you enter.