Presumo che tu voglia restituire la chiave della stanza come risultato della query...
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'))