What is the minimum distance from a building to a transformer per NEC? I believe the transformer is 12kVA. The buildings are three story apartments, 24 units each, with 120/208V, 3Ph, 4W service panels.
Distances between transformers and buildings are usually addressed under fire code rules by the AHJ or the facility insurance companies. Most POCOs also have their own minumum rules.
The answer to your question depends on the city and state.
You might also have to consider if it is gas, natural gas, propane etc. The size of any fuel tank might also be a factor.
Contact your local AHJ for your answers.