The formality or personalization of a note to a co-worker will depend on how close you are with them. If you’re terribly close, then you may want to stick with the close friend category. Assuming you’re not all that close, then you might make it a bit more formal.
Often when a co-worker loses a family member, everyone in the office signs a large sympathy card, and that is perfectly fine. You can simply add your signature, or you can add a simple “I’m so sorry for your loss,” or “thinking of you,” or “let me know if you need anything,” or anything of the sort that you feel is appropriate, given your relationship with them.
Signing the office sympathy card doesn’t preclude you from sending one of your own, however, if you feel so inclined, depending on your relationship with the person. In this case, you may want to purchase a smaller, more personal card, and add a note saying something like:
I’m so sorry for your loss. We’re all thinking about you. If you need someone to talk to, I’m a good listener.