Is one allowed to be in an apartment with the door unlocked or opened with a maid or cleaning lady when few people walk by but there is a chance someone can walk in and does it make a difference if one is married or not? and does a two year old child help the situation and if not at what age does a child help the situation?
"Pesach Posuach Lireshus Horabim", an open door, is more than just a literal open door. It is the idea that the house is theoretically open to the public, so an uninvited guest/passerby could theoretically walk in. So if the door is open, but no one could possibly get in uninvited (e.g. there is a gate around the house), an open door would not help at all. (see here). That's why the heter only works during the day. And that is why there may be situations where the door does not have to be physically open.
Later on, he writes:
There is an idea in the Laws of Yichud that a persons wife guards him from immoral behavior, provided that she is close by. Therefore, "if a man is at home alone and his wife is at work, and a female housekeeper arrives to clean, then he should leave the door literally open, thereby creating a Pesach Posuach. If his wife is in the vicinity and she is expected home shortly, then if she has the key, the door may be closed. If she doesn't have the key, the door may be closed but left unlocked."
Here he explains that children function as shomrim to permit Yichud from the ages of 6 to 9, when they are old enough to know what's going on, and young enough to be immune from participation.
A little later on he says, "A child is an effective shomer for allowing the Yichud of a man with a prutzah or a non-Jewish woman. Therefore, a man may be alone in the house with a non-Jewish cleaning lady in the presence of a child shomer."
In Footnote 48 he brings opinions who explain that even observant Jews may still be considered Prutzim when it comes to the laws of Yichud, if they meet the criteria:
However, it seems that doing what needs to be done to prevent Yichud with a housekeeper is also sufficient if the man is a "Parutz" (I may have missed some aspects though).
Actually you have number of question here. Let's start one by one.