Question:
I am buying a building
one tenant is a church
can i buy
Answer:
This is a difficult question, but I can give some broad guide lines. The Rambam and Shulchan Oruch rule that one is allowed to build the yard (and get payed) where the avodah zoroh will be situated. Therefore one would be allowed to rent out a flat to a church. Never the less if there is a possibility maybe there is some way of avoiding the situation because of הרחק מן הכיעור. (Move away from ugliness).
Sources:
Rambam Avodah Zorah 9:11, Y;D 143:2