Buildings are generally exempt from VAT, but there are a lot of exceptions to this.
A person who holds an interest in a building (freehold or leasehold) can opt to tax the building, such that income from selling or letting the building is subject to VAT.
If you purchase a building and the purchase price includes VAT, you do not have to opt to tax that building.
Consider Ali who owns a VAT registered car repair business. He purchases a new commercial unit for £200,000 plus VAT of £40,000. The unit is used entirely for the car repair business, so Ali can reclaim the VAT of £40,000 in the same way he reclaims VAT on other purchases.
Ali does not have to opt to tax the unit to reclaim that VAT. In a few years Ali may want to sub-let the unit, in which case the rent will be exempt from VAT. This will make Ali's business partially exempt, which may mean he cannot reclaim all the VAT charged on his purchases. In that situation Ali may choose to opt to tax the building so the rent must have VAT added.