The claims about IBM are tenuous at best and irrelevant outside the Reich proper.
The Nazis exploited existing registration systems in all the countries they occupied, which would include for example Soviet passports specifying the 'nationality' of a person as Jewish, or as mentioned above the Dutch case specifying religion. As commented above by various posters, if Jews belonged to organised communities then thewere synagogue records and other civic registers which could identify who was and wasn't Jewish.
Only in some countries was an Ahnenpass-like effort to research grandparents in parish records demanded. But in principle, if one wanted to prove that one was not Jewish, then resort to parish records would settle any argument.
There were usually registration censuses shortly after the Nazis occupied a particular territory, which exploited these sources and which elicited varying rates of compliance. In France, censuses had not recorded religions and there was no compulsion to reveal one's religion until Vichy passed Nazi-style Jewish laws. Slovakia, Hungary and Romania required Jews to register between 1938 and 1941 at various stages.
What all these registrations share in common is that they took place before mass murder began, were probably not complete, and resulted in a lot of police work tracking down Jews with false, 'Aryan' identities, which for the menfolk meant asking them to drop their trousers.
Once Jews in Germany, the Netherlands, France, Poland and elsewhere realises that 'Aryan' papers were highly desirable, then there was a considerable effort to acquire them, hampered by the need to contact good forgers. In all these countries substantial numbers of Jews hid themselves using false papers if they did not simply resport to the Anne Frank method of hiding in an attic or in forests (which ran their own risks, and usually resulted in eventual discovery).
Thus, by the time the roundups had started, Jews had long been identified, registered, forced to wear yellow stars and often interned in camps (eg French internment camps for German Jews) or ghettos. In no case was a 100% roundup rate achieved, as people escaped from camps and ghettos, refused to wear yellow stars, avoided registration, and avoided identification.
There is a grey zone in the opposite direction - namely persons who were deemed racially Jewish but had converted to Christianity. Identifying such people was easiest in Germany, but was nominally practiced in all countries where there were Jewish laws as well as all German occupied territories. The key variable was the rate of conversion, which was highest in Germany and Hungary and virtually irrelevant in the USSR. 'Racial' Jews added at least 5% to the number of Jews recorded by the Hungarian census of 1941, with a heavy concentration in Budapest where assimilation was at its strongest. Thus Tim Cole in his book Holocaust City actually puts 'Jews' in inverted commas throughout the book to recognise that many of the victims herded into the Budapest ghetto did not consider themselves Jews at all.
The OP asked about political prisoners, homosexuals and other target groups - these almost invariably had to be caught in the act, unless they were already 'in the system'. Quite a large number of convicted criminals were handed over to the KZs either as 'habitual criminals' or 'asocials', and this depended entirely on their police records, sentencing etc. 12,000 'asocials' were handed over to the KZs in the winter of 1942-3 by agreement with the Justice Ministry, and most were dead by the spring due to deliberate maltreatment in the worst camps like Mauthausen.
Political prisoners could be identified either by captured records of political parties or by their activities. KPD and SPD activists were not difficult to identify as the senior activists were public figures, up to and including members of the Reichstag. But it is obvious that the majority of KPD and SPD members were not sent to KZs. In the USSR, some communist party records were captured, eg Einsatzgruppe B captured the card index of the CP of Belorussia in Minsk, and used this to identify 'communists'. In all areas, denunciations, informers and dragnets did the rest.
Jehovah's Witnesses were easy to identify; if they refused military service or war work, or proselytised, then they drew attention to themselves.
Even if one takes a conservative estimate for the percentage of homosexuals in German society, then the few thousand sent to KZs were a tiny fraction of all homosexuals in Nazi Germany. Adenauer's Federal Republic actually prosecuted more homosexuals under article 175 than were prosecuted by the Third Reich.
The most complex case is probably the identification of Roma and Sinti. A considerable effort went into identifying German and Austrian Roma via the ancestral proof method, but in other countries the criteria were generally more along the lines of, here's a gypsy community, let's intern them. Thus I would imagine that Czech Roma who had assimilated into Czech society and no longer had a 'gypsy lifestyle' could pass undetected and avoid deportation.
By the middle of the war, the majority of KZ inmates in the camps in the Reich, i.e. Dachau, Buchenwald, Sachsenhausen etc, were actually foreign workers who had drawn attention to themselves by 'refusing to work' or other real or spurious offenses. Given that there were 7 million foreign workers in the autumn of 1944 but 700,000 KZ prisoners by January 1945 with many hundreds of thousands having died before then (just counting the camps in the Reich, i.e. excluding Auschwitz and Majdanek), then it is not difficult to see how there could have been 100,000+ foreign workers arrested by the Gestapo and sent to KZs if there were so many overall. Robert Gellately and every other scholar who has written on the Gestapo in the past 30 years has emphasised the point that the majority of Gestapo work was directed at policing the foreign workforce by mid-war. By then, of course, most German Jews had been deported anyhow.
It is very difficult to come by good figures breaking down nationalities of the deportees to KZs. Things are easier for Western Europe where there are good memorial books compiled for both political and 'racial' deportees. For France we have the following picture
65,234 French politicals deported from occupied France to KZs
6,609 French deported from annexed Alsace-Lorraine to KZs
6,391 French arrested inside the Reich as foreign workers, sent to KZs
6,737 Spanish Republicans already interned by the French, to Mauthausen
1,537 French deported for unknown reasons (incomplete info)
779 French deported for reasons of racial persecution (incl a few gypsies)
= 86,000 'French' deported to concentration camps, of whom 40% died
75,000 Jews were deported from occupied France on top of this, out of more than 300,000 Jews estimated to be living in France in 1940. Only 2000 Jews returned.
There are similar figures for Luxemburg: 3,963 'politicals' deported, 791 died, plus 683 Jews deported, of whom 640 died. The Netherlands lost 11,000 'politicals' deported of whom 4,000 died, versus 104,000 Jews deported of whom more than 100,000 died. These don't include executions in the relevant countries.
The upshot is that the concentration camps were used very sparingly to victimise Germans and Austrians. And certain categories, such as homosexuals, more or less only came from Germany and Austria. Homosexuality was not illegal in France before 1940, and was not really made illegal thereafter.