The first thing you need to do is to ask yourself if you are ready to take the risk of office romance. You need to be sure before venturing into such an affair because if the romance between you and your work colleague ever takes a nasty turn in the future, things can become pretty complicated since you will have to face and maybe even interact with them every single day while you both work in the same office. Do not take this as just a fling, as it can have some serious consequences for you and your career.
If you are absolutely sure that the risk is worth it, make sure that the person you are about to ask out is not a superior. Irrespective of what you may have read in the books on watched in films, superiors never date their subordinates. It is almost like a universal policy that is strictly followed by superiors. Asking them out will be futile and even if they become careless, you can end up losing your job or getting in some serious trouble. The superior will also end up getting marked and become a popular topic of discussion for gossipmongers. However, there can be exceptions and since you are already clear about the risk being worth it, take your chance only after ensuring the next step.
Determine if your colleague is interested in you. You need to be extremely careful while reading and assessing the signs. Does your co-worker spend too much time around your workstation unnecessarily? Do you often catch them staring at you? Does your co-worker give you a smile whenever your eyes meet? Is your co-worker being over-friendly with you? All these things may suggest that your co-worker is interested in you. However, it can also mean that they think of you as a good person and feel comfortable around you, not attracted to you. Proceed further only if you are hundred percent sure that you will not get into too much trouble for misreading the signs.
Once you have established that both you and your colleague have feelings for each other, approach them and confidently ask them out. Since it is going to be the first time you are taking them out, be sure to select a fancy restaurant. You can ask them to suggest a place or activity for you two to do together after work as well.
If your colleague turns you down, give up immediately. Any kind of pressure can get you in trouble on charges of harassment. Do not start avoiding them and continue to be normal with and around them.