Question:
A person who was in yichud without realizing it (there was a lady in the office and I didn’t realize it, or I didn’t realize that the door had closed, or a similar mistake), did he transgress?
Answer:
The first time that this happens there is room to say “ones rachmana patrei”, that it was beyod your control, because you didn’t know what happened in a different part of the office. However if this is indeed a situation that comes up, you have to be careful about it.
Best wishes