What is a word for someone without allegiance?
Solution 1:
The word that comes to my mind is nonaligned.
Someone willing to work for any side that pays them, regardless of ideology, might be described as mercenary.
Solution 2:
In sports and a variety of other industries, such a person is known as a "free agent".
Solution 3:
Such a person is self-serving (Merriam-Webster):
serving one's own interests often in disregard of the truth or the interests of others
You could also say that they were mercenary (Merriam-Webster), which has a much more aggressive implication:
one that serves merely for wages; especially : a soldier hired into foreign service
We tend to think of psychopaths and sociopaths as violent monsters, but Psychology Today has this definition (my emphasis):
First a bit of terminological history, to clear up any confusion about the meanings of “sociopath,” “psychopath,” and related terms. In the early 1800s, doctors who worked with mental patients began to notice that some of their patients who appeared outwardly normal had what they termed a “moral depravity” or “moral insanity,” in that they seemed to possess no sense of ethics or of the rights of other people. The term “psychopath” was first applied to these people around 1900. The term was changed to “sociopath” in the 1930s to emphasize the damage they do to society. Currently researchers have returned to using the term “psychopath.” Some of them use that term to refer to a more serious disorder, linked to genetic traits, producing more dangerous individuals, while continuing to use “sociopath” to refer to less dangerous people who are seen more as products of their environment, including their upbringing. Other researchers make a distinction between “primary psychopaths,” who are thought to be genetically caused, and “secondary psychopaths,” seen as more a product of their environments.
Such people typically appear 'normal' as long as nothing contradicts their desires: when it does, they follow their own ends without regard for other people.
Solution 4:
In some situations, such people could be described as unaffiliated, independent, beholden to no-one, or owing their loyalty to no-one. They might also be considered to be free spirits or free agents.