When you want to express condolences to a Japanese friend or acquaintance over his or her loss of a loved one, the appropriate phrases are:
For written condolences
Something akin to "Allow me to express my sadness and pain."
おくやみもうしあげますFor written or spoken condolences
A humble way to say, "Allow me to tell you of my mourning and regret."
For spoken condolences
A very respectful way to say "You must be in great sorrow." (Thus acknowledging the recipient's loss and hardship.)
The English translations are only here as an accompaniment to help readers unfamiliar with Japanese to understand the phrase. The Japanese phrases themselves are set, standard expressions to use when greeting a person in mourning and not usually meant to be altered or combined. As with standard Japanese greetings in formal correspondence, it's most common to use these phrases as a greeting in a letter (or conversation) with a friend in mourning, then follow it with your own, more personal message about the deceased or your sympathies.
Credits again to funeralservice.livedoor.biz for their informative and tactful archive of information on funeral services in Japan.