I'm still rather new to the game.
I was trespassing in a house to make some gold from stolen items. I always make a note of what NPCs are around and observe their routines before moving around (habit picked up from Skyrim).
In this occurrence, one of the NPCs was lying dead on the floor, so no threat, however, after clearing a few storage areas, this NPC suddenly appeared out of nowhere, just in front of me, and attacked me. The guard rushed down and joined in (I have learned that immortal guards are actually not a bug, but part of the game "design"). Having planned my exit route before making a move in case anything happened, I promptly made my way to the door, but was unable to open it (the option to open was not greyed out, just never appeared). I tried a few other doors, all the same.
I lost a couple of blueprints in the process, so a fair bit of gold, which I am quite annoyed about.