My local Rabbi told be that it is forbidden to enter the bedroom of a married couple. What is the source for this? Does this only apply to a couple whose marriage is recognised by Jewish law? When does this prohibition cease (like a widow for example?) At what age does this prohibition take effect (boys over the age of 9?)
Perhaps due to this Rashi in Succah 21:
להכי נקט גבי מטה מנעלים וסנדלים דאמרי' בבבא בתרא (דף נח.) איזהו מטה של תלמידי חכמים. כל שאין תחתיה אלא מנעלים של בעל הבית בימות החמה וסנדלים בימות הגשמים שנותנים שם כשהוא בא לשכב ולישן חולץ מנעליו ונותנן תחת מטתו אבל לתת תחתיה דברים אחרים גנאי הוא לו שמרגיל בני הבית לשם
Seemingly it is offensive to hang around there. The Rashbam in Bava Basra explains it differently, though. He connects it to Ruach Ra.
I'm assuming he is referring to the gemara in Eiruvin 63b Rav Bruna said in the name of Rav whoever sleeps in the room of a husband and his wife are gets the passuk from Micha 2 'the women of my nation are sent from their house of enjoyment'. Rashi explains that they are embarrassed from their guest. Presumably meaning the problem is they won't be intimate, as that is what the previous section was discussing.
But Rav Yosef adds one should not sleep there even if the wife is a nida. Maharsha explains in the name of Rabi Yehonason that the problem is they will be embarrassed to talk about private matters.