The Halachot governing Minyan require that all ten men assemble together in the same room. The Shulhan Aruch (55:20) rules that someone standing outside the room of the Minyan may answer the Devarim SheBikdusha, such as Kadish and Barchu, even though he doesn’t count towards making the Minyan. This is on condition that there is no separation of garbage or putrid items that would serve as a barrier.
The question arises as to whether someone praying in an adjacent room to the Minyan is considered as having prayed Tefila B’Sibur (communal prayer). This issue is discussed by Hacham David in his Halacha Berura (4:46, p.109). There he rules that as long as the person can maintain eye contact with the Minyan, he is considered a part of it. He cites the opinion of the Radbaz (Rabbi David Ben Zimrah, 16th Century Tsfat) as quoted by the Hida in his Birkei Yosef (90:6) and his Machzik Beracha (55:5,9) that even if he cannot see the Minyan because his view is obstructed, nevertheless, he is still considered a part of it.
All ten men must be in the same room to make a Minyan.
Someone outside of the Minyan may answer Kadish and Barchu, and is considered as having prayed B’Sibbur.