It is stated in the Gemara (85a): Two houses and three ruins between them, and ordinarily there is no open doorway from a house to a ruin, because there is no complete usage there, but rather they use it by way of windows—each one is permitted to use the one next to him by way of throwing through windows, and his fellow does not prohibit him, because the usage is more convenient for him than for his fellow who is far from it. (Rashi) And the middle one is permitted to both of them, for they can only use it by way of throwing, and with a distance of air space where the outer one intervenes for each, and a person does not prohibit his fellow by way of air space in such inferior usage, as has been written in section 4. And this is when the middle one stands between the two outer ones. But when it stands without the intervention of the outer ones, such as when they stand like a segol, and it turns out that the middle one is also adjacent to the houses, as it stands opposite the two like three heads of a jar—each one is permitted in the ruin next to him, and the third one which is close to the two courtyards is prohibited to both of them, for both of them use it only by way of lowering, and they prohibit one another. And even though regarding a pit we permitted in such a case, this is because in a pit there is only one usage, drawing water. But in a ruin there are many usages, and they prohibit one another. (Rashi ibid. s.v. 've-emtza'i') And the Baal HaMaor wrote the reason, that since it stands alone adjacent to the public domain, we fear perhaps something will fall into the public domain and he will come to bring it; see there. And the Tur wrote that these ruins, even if they belong to other owners, do not prohibit, since they do not dwell in them, and a dwelling without owners is not called a dwelling. And a bathroom that is between two houses that did not make an eruv together—they prohibit one another, since the domain of both of them has authority over it, and the laws of a bathroom were explained above in siman 355.
איתא בגמרא (פ"ה.): שני בתים וג' חורבות ביניהם, וסתמא אין פתח פתוח מבית לחורבה, מפני שאין שם תשמיש גמור, אלא משתמשים בה על ידי חלונות - כל אחד מותר להשתמש באותה שאצלו על ידי זריקה דרך חלונות, ואין חבירו אוסר עליו, לפי שלו נוח יותר התשמיש מלחבירו שהוא רחוק ממנה. (רש"י)והאמצעית - מותרת לשתיהן, שהרי אין יכולין להשתמש שם רק על ידי זריקה, ובהפלגת אויר (שהחיצונה) [שהחצונה] מפסקת לכל אחד, ואין אדם אוסר על חבירו דרך אויר בתשמיש גרוע כזה, כמ"ש בסעיף ד'. וזהו כשהאמצעית עומדת בין שתי החיצונות. אבל כשהיא עומדת בלי הפסק החיצונות, כגון שעומדין כסגו"ל, ונמצא שגם האמצעית סמוכה להבתים, שהיא עומדת כנגד השתים כשלשה ראשי קנקן - כל אחד מותר בחורבה שאצלו, והשלישית הקרובה לשתי החצרות - אסורה לשתיהן, שהרי שניהן משתמשין רק על ידי שלשול, ואוסרין זה על זה. ואף על גב דגבי בור התרנו בכהני גווני, זהו משום דבבור יש רק תשמיש אחד, מילוי מים. אבל בחורבה יש תשמישים הרבה, ואוסרין זה על זה. (רש"י שם ד"ה 'ואמצעי') ובעל המאור כתב הטעם, דמתוך שהוא עומד לבדו סמוך לרשות הרבים - חיישינן דילמא נפיל לרשות הרבים ואתי לאתויי ע"ש. וכתב הטור דחורבות אלו אפילו שייכים לבעלים אחרים - אין אוסרים, כיון שאין דרין בהם, ודירה בלא בעלים - לאו שמה דירה. ובית הכסא שבין שני הבתים שלא עירבו יחד - אוסרים זה על זה, כיון דרשות שניהם שולטת בו, ודיני בית הכסא נתבאר לעיל סימן שנ"ה.