So this is for a trigger right?
Are all of these buildings the same type? If same, count units of type owned by each player on team.
count player1 + count player2 + count player3
if the count is 0, they lose.
If it's of multiple types, an easy way is to enumerate over units of type UNIT_TYPE_BUILDING. If the count between all players on that team is 0, that team loses.
There are better ways to do this. If all of the buildings are of the same type and you have a set number at the start (don't build any new), then you can just register an any unit dies event and subtract # of buildings on team every time a unit dies.
If you can build them, you can increase count of buildings on team every time a new building is finished.