The Shulhan Aruch rules (Orah Haim 55) that ten people form a Halachic Minyan only if they are present together in one room. If nine people are in a room and a tenth is outside in the hallway, or even in the women’s section, then they do not form a Minyan, even if the tenth person can see the other nine. The Mishna Berura (Rav Yisrael Meir Kagan of Radin, 1839-1933) rules more leniently, allowing one to count for a Minyan even if he is in a different room, as long as he can see the others. However, we follow the stringent ruling of the Shulhan Aruch, that the ten people must be present in the same room. Ten men in one room form a Minyan even if they cannot see one another.
This Halacha refers only to the question of forming a Minyan, requiring that ten people are present in the same room. If, however, there already are ten men in one room, then people situated outside that room – such as in the hallway, or in the ladies’ section – are allowed to answer "Amen" to the Berachot of the Hazzan’s repetition of the Amida, and they may respond to Kaddish, Nakdishach and Barechu. Even if one cannot see the Minyan, as long as hears the Beracha, Kaddish, Nakdishach or Barechu, he may respond. For that matter, if one’s home is situated next to a synagogue, and he hears the prayers, he may answer. In fact, according to Hacham David Yosef (in Halacha Berura), even if one hears a live recording of a Minyan, he may answer to all the Berachot and all the prayers. Indeed, there are ill patients who are unable to attend the prayers in the synagogue but listen to the prayers through a live feed, or via telephone, and are then able to able to answer "Amen" and respond to all the prayers.
It is questionable, however, whether one is credited with Tefila Be’sibur – praying with a Minyan – if he can hear the Minyan but cannot see them. It appears from a responsum of the Radbaz (Rav David Ben Zimra, Egypt, 1479-1573) that he maintained that one is considered to have prayed with a Minyan in such a manner, whereas others disagree, and require one to see the Minyan in order to be considered to have prayed with them.
Summary: Ten men form a Minyan only if they are all in the same room, in which case they can form a Minyan even if they cannot all see each other. But if even just one of the ten is in a different room, then even if he can see the others, the group cannot form a Minyan. Once ten men are together in one room and form a Minyan, anyone who hears Kaddish, Nakdishach, Barechu or the repetition of the Amida may respond, no matter where he is or whether he can see the Minyan, even if he hears the prayers or Berachot via live feed or telephone. It is uncertain, however, whether one is credited with praying with a Minyan if he cannot see the Minyan.