Je suppose que vous voulez récupérer la clé de la chambre à la suite de la requête...
SELECT DISTINCT rm.Id as RoomId
FROM ts_room rm LEFT JOIN ts_roompref rp ON rp.room_id = rm.id
LEFT JOIN ts_request rq ON rq.id = rp.request_id
LEFT JOIN ts_allocation a ON a.request_id = rq.id
WHERE building_id = :building_id
AND (a.status IS NULL OR a.status IN ('Pending', 'Failed', 'Declined'))