This is a bit of 余談 (余計なお世話かもしれませんが・・・

), but I was reading a bit online, and it appears that this phrase is misused a lot, and that people don't understand what it actually means. Apparently 冥福 means you pass successfully though 冥土, which is sort of a purgatory that you wander through for 49 days before reaching 極楽, so ご冥福をお祈り致します literally means you're praying for the departed's successful passing through 冥土, and their passage into heaven. However, it's really specific as to the religion, and even sect. For example, Christianity doesn't have 冥土, and neither does 浄土真宗, so saying it to someone of one of those faiths would be insulting.
You can read about it at
つぶやき古道(コミチ). Also, there are other pages on the subject that you can browse via Google search:
冥福 祈る 間違い.