Being a good colleague is easier when you can put yourself in the other person's shoes. The important thing to understand is not always how you would react or how you would prefer to be treated in a particular situation, but how your colleague would feel and prefer to be treated. Empathy can work to prevent many problems in the office.
The Golden Rule is that you treat others as you would want to be treated, but not everyone wants to be treated the same way. One co-worker might want to be invited out for social events after work, while another may prefer to get straight home to his family. Some colleagues might like to stop and chat for a minute whenever they see you, while might find this distracting. The key to treating others respectfully and earning their respect as a colleague is to pay close attention to who they really are and what they really prefer.
People don't go to work every day just because they feel like it, but to accomplish something, earn a living and build a career. They respect co-workers who help them accomplish their goals and usually resent those who stand in the way of achieving those goals. An essential characteristic of a good co-worker is reliability. Always do what you say you are going to do when you say you are going to do it. Ask for help if you need it to avoid delays. Don't promise more than you can actually deliver.
A certain amount of gossip is inevitable in a work environment and may even help build personal connections between co-workers; however, mean-spirited gossip is destructive. It can damage the reputation and career of the person repeating the gossip as much as the person being gossiped about. Along with refusing to engage in spiteful gossip, exercise restraint in conflicts with co-workers. Most colleagues won't consider you a tattler for bringing an issue to the boss after you've already done everything you can to resolve it privately, but if you are perceived as someone who goes behind her co-workers' backs, your reputation might suffer for it.
In most situations and with most people, it's better to compromise and preserve the relationship rather than provoke needless conflict. The one big exception to this is in when you are confronted with unprofessional or unethical behavior from a colleague. Inappropriate humor, harassment, bullying or any other form of unacceptable treatment toward you or a colleague should be dealt with firmly the first time it happens, before it can escalate to something worse. Colleagues will respect a co-worker who takes a stand when it really matters.