We all have at least one co-worker who constantly complains and never seems to have anything positive to say.

Emotions are contagious and negative attitudes can spread quickly. That’s bad news for workplace morale and productivity.

“It drains people’s energy and it sucks the joy out of being at work,” said Marie McIntyre, a career coach and author of “Secrets to Winning at Office Politics.”

Even though you can’t control what other people do, it is possible to prevent the negativity from affecting your own work.

Look for a pattern

If you work closely with a major griper, try and find the source of the problem, advised Lynn Taylor, a workplace expert and author of “Tame Your Terrible Office Tyrant.”

“Are they complaining out of inadequacy, loneliness, fear, fatigue? Is it happening at a certain time every day? Get clued in to that and that might help you nip it in the bud.”

Often when people are fearful of something, they turn to complaining as a coping method, so finding the root cause and helping to alleviate some of the fears can blunt the complaining.

Withdraw attention

Complainers need an audience, so if you don’t give them room to air their grievances they will go elsewhere.

“Allowing them to vent doesn’t get rid of the problem, it reinforces it,” said McIntyre. Changing the subject can be a good escape route. “The lovely thing about being at work is work is always an escape, you can just say, ‘I understand that is frustrating, but I have to get back to work.’”

And while it’s tempting to join in on the complaining, that will only add fuel to the fire and reinforce that you are open to such conversations.

Set boundaries

If you work closely with a neverending complainer and must meet frequently, set some clear limits.

“Have an agenda and stick to it,” said Hallie Crawford, a certified career coach. Let the person know you only have 30 minutes and structure the interaction as much as possible.

If the complainer comes into your office, a good way to limit the conversation is to stand up, she added.

Another way to deter a complainer is to explain how you are changing your approach to work situations. “Declare a personal resolution that you are going to stop complaining about things since it drags you down and you are trying to change your focus,” said McIntyre.

Approach delicately

It can be difficult to tell someone that their negative attitude is affecting your work.

Crawford suggested telling the person that you need to talk about a touchy subject and asking if they are open to having a conversation about it.

“You aren’t blindsiding them with something that might be uncomfortable. It helps them to be less defensive,” she said. “They can take a deep breath and mentally prepare for a minute.”

Involve the boss

If the situation is getting out of hand and affecting your productivity, consider escalating it to the team leader. Going to your boss can be risky and can make you look like a complainer yourself, so be tactful with your approach.

“Present it as a business problem, not as a personality problem. Managers hate personality problems,” said McIntyre.

Mention that you are concerned it is affecting morale in the office and that you are having trouble doing your work because of the interactions with the complainer.

“Try to come up with possible solutions and ideas that could help the situation,” suggested Crawford. “You want to be a team player and try to help a person who seems unhappy.”