Upvote:6
The passport number is not the only data point that countries can use to match an individual.
Among other points that can be used are name, gender, date of birth, place of birth, all of which appear on the passport and together can uniquely identify pretty much anyone on earth, as well as biometrics (when available).
In addition to demographics, they can also match on credit card numbers and this adds a layer of risk to gaming the system with two passports.