Claudius unfortunately there's no elegant way of doing this, you either have to make two queries to get all ranks or roles, then compile the IN condition for the second query from that, excluding whatever ranks/roles you do not want OR as you wrote, handle it while you loop over the users, the problem there is, that you don't know how many users in the amount of users you fetched will be excluded, so if you want to make a Top 20 and you fetch 25, it's possible that 8 of these users are Admins and therefore your Top 20 would only be a Top 17... that means you need to increase the LIMIT on your query and hope for the best...
The main issue here is that the v2 API primarily uses a "whitlisting" approach for WHERE conditions, e.g. you have to specify whatever you WANT, but you can't really tell it to return everything EXCEPT some things you do NOT WANT =)...
If you think that would be useful, consider upvoting my related idea (which in the end would basically allow for NOT IN() where conditions...
https://community.khoros.com/t5/Khoros-Community-Ideas/API-v2-boards-collection-Allow-conversation-style-constraint/idi-p/491889
I would have suggested to aggregate all top level roles (I assume that would be enough for your filter purposes) with:
SELECT * FROM roles WHERE node.id = 'community:<community-id>'
as described in the docs but unfortunately I was unable to successfully use this query, as it simply returns an empty result instead of the top-level roles... can you reproduce that on your side as well? Claudius ping SuzieH