There are ALL types of personalities in the work setting. There are sweet people, mean people, amicable people, prima donna people, alpha people, beta people, venomous people, martyrs, manipulators, & others who are simply beyond indescribable. There are difficult people in this world, that is part of living on the earth plan.
There are difficult people from childhood. Children encounter other children who are deemed difficult from siblings to classmates, even friends. Children even have difficult parents &/or other adult family members. Difficult people are not only at work but everywhere, even in families. Now that being said, working w/ difficult people can be quite a challenge from co-workers to supervisors, managers, & even superiors.
With a co-worker, one just have keep things at a purely business level. Only discuss things that are work-related, don't go beyond that. One has to be totally no-nonsense. Establish firm boundaries w/such people, be assertive, & demand respect from them. There are many emotional & psychological reasons why some people are difficult at work but that is never here nor there. The main emphasis is to keep the relationship between you & that co-worker on a strictly professional level. If the co-worker is too difficult, alert your supervisor or manager regarding the situation to see if this situation can be remedied to your satisfaction.
If the difficult person is a supervisor or manager, one can request a transfer if the situation becomes too difficult for this supervisor or manager has a more controlling factor regarding your work environment & work quality of life. In other words, this supervisor or manager can make your work life a living lower purgatory to a psychically agonizing lowest pit of hell. Be businesslike at first for survival reasons but get out at the first possible opportunity. You really don't have to endure this beyond a certain point with a difficult supervisor or manager.