there isn’t a single API query that will get you secondary pages which are not linked to any tertiary page that I know of or can figure out. so you would need to get all entries of the secondary page content type then 1-by-1 query each one with the
links_to_entry parameter and only include it in the available list if the
Another way would be to get all the tertiary pages and extract out the linked secondary pages, then compare that array to the list of all secondary pages.
As far as the display of the resulting list, I don’t know of any open source resources we have to make it look like the native reference selectors, so I think you’d need to build your own.