WordPress pass url to page template when page does not exist

You are getting a ‘page not found’ because it is exactly that, not found.

What you can do is create a page, for instance, called ‘locations’ then set it up like this

example.com/locations/the-hamptons => index.php?page_id=[id_of_locations]&filter=the-hamptons