Show all location codes.
select location_code from document_locations
For each of them, count the number of corresponding documents.
select location_code, count(*) from document_locations group by location_code
Which of them have at least 3?
select location_code from document_locations group by location_code having count(*) >= 3