Formulas are here:
http://valk.dancing-mad.com
I would say always prioritize MND. It would take an awful lot of a secondary stat difference to make up for losing MND. If the debate is between 2 pieces of same ilvl gear, then you usually don't have to even think about MND because it's generally capped for that item anyway, which also means you don't generally have to think about melding it either. MND sort of auto-prioritizes itself that way.