My dear Swati
It is natural for people to shy away from things which have given them bad experience.
A cat who has walked over hot bricks, will not walk over a hot brick again. But the flip side of it is - it will not walk over any bricks again.
Wherever people assemble, male(s) or female(s), and spend considerable time together doing the same or separate activities, individual and group dynamics are bound to take place.
A person should guide oneself with dignity and should be mindful of the office decorum.
A colleague can be a very good friend too; and he/she is much more accessible (in terms of visible contact) than anyone else.
Not having any friend in office; or, not developing friendship with anyone, is just denying oneself the goodness of true friendship. Colleagues become good friends because they have true respect for each other and know the worth of a friend.
Most of my good friends, over the years, are those with whom I had the opportunity to work together.