Sometimes I am at home with my father and grandmother (mother’s mother) – both not yet religious. If I need to leave the house (to daven), am I allowed to leave even though they will lock the door (or sometimes I lock the door) and be in yichud? They do not understand the need to leave the door open, and even if the door would be left open, doing so does not necessarily help if we are not expecting any visitors.
Although it would be preferable to stay with them never the less if you have to leave you can go.
Tzitz Eliezer 7:42