Yes, red doors and the like are considered trespassing. You will be stopped if spotted.
For the library, talk to library and request permission
If you're in the store trying to find an alternate entrance in the back.
If you open the container even you don't take anything the guard. You try sneaking.
Moving a box will cause issues so do it from a distance with telekinesis.