Hi and welcome to JustAnswer:
If you have a building worth $1.8M and you sell it to a charity for $1.2M it is called a bargain sale. Simplistically, you have a gift of $600K and you have a sale of 2/3's of the building. Thus you will allocate your basis between the gifted portion and the selling portion. You will report a gain on the 2/3s you sold. See IRS Publication 526 page 13 "Bargain Sales" for complete details (Link below).