Maseches Kesubos 15b says we can go after the majority of types of people in the city. So if most of the population is Gentile, in a case where someone who looks gentile is found in the street he can be a Shabbos Goy as we follow the Majority:
מצא בה תינוק מושלך אם רוב עובדי כוכבים עובד כוכבי' אם רוב ישראל ישראל מחצה על מחצה ישראל
Even if the Gentile is in his house in a City of mostly Jews, if you ask him "are you Jewish" and he says "no" you can rely on him as a Shabbos Goy. this is because Most people who say they are not Jewish are genuinely not Jewish this is רוב- Majority. We are not worried about the minority who are Jewish and pretending to be Gentiles (whom we cannot ask to break Shabbos) because they are NOT Kavua as Tosfos Nazir 12a explains:
לא אמרינן קבוע כמחצה דמי אלא כשהאיסור ניכר לעצמו וההיתר ניכר לעצמו אבל כשאין האיסור ניכר לעצמו לא אמרינן קבוע
We do not say "Someone fixed is like 50/50" in a case where we cannot specifically locate the fixed person (i.e we cannot pinpoint where these self denying Jews homes are)"
So, since someone hiding his Jewishness is not Kavua as he cannot be located, we can rely that the person being asked to do a Melacha (CYLOR only specific Melachos are permitted by a Goy) if he/she says he/she is a Gentile based on "majority"(i.e majority of people who say they aren't Jewish are not Jewish).