This is a good question! mhchem's manual doesn't mention escaping from its formula parsing which not only sets the 2 as subscript but also transforms the dash (-) into a single bond.
It does mention one way implicitly: using $...$. Thus the usual way to prevent mhchem's parsing is indeed to switch to math mode, i.e., use $...$ inside \ce{}. So your hack is not so much a hack, really, but for many cases the way to go. It is unfortunate, though, to escape to math mode just to go back to text mode with \text{} again. In cases like yours an \mbox{} is probably better or at least easier and less to type:
\ce{[Ru(cod)(\mbox{2-}methylallyl)2]}
Another way would be to omit the $...$ and to use \text{} directly: mhchem's formulas all are already in math mode! The documentation doesn't advertise this (which sometimes causes unexpected errors).
\ce{[Ru(cod)(\text{2-methylallyl})2]}
There is actually another implicit way to prevent a number being set as a subscript: make mhchem believe that it is a stoichiometric factor by leaving a blank before the number:
\ce{[Ru(cod)( 2-methylallyl)2]}
This, however, will lead to an unwanted space after the dash! This is the space that mhchem inserts after stoichiometric factors which can be verified by setting \mhchemoptions{skip-after-amount=}. Since - is not a letter (i.e. it hasn't catcode 11) it is interpreted as part of the stoichiometric factor.
A comparison of the different cases:

\documentclass{article}
\usepackage{mhchem}
\begin{document}
\begin{tabular}{ll}
\verb!\ce{[Ru(cod)(2-methylallyl)2]}! & \ce{[Ru(cod)(2-methylallyl)2]} \\
\verb!\ce{[Ru(cod)($2\text{-}$methylallyl)2]}! & \ce{[Ru(cod)($2\text{-}$methylallyl)2]} \\
\verb!\ce{[Ru(cod)( 2-methylallyl)2]}! & \ce{[Ru(cod)( 2-methylallyl)2]} \\
\verb!\mhchemoptions{skip-after-amount=}!: \\
\verb!\ce{[Ru(cod)( 2-methylallyl)2]}! & \mhchemoptions{skip-after-amount=}\ce{[Ru(cod)( 2-methylallyl)2]} \\
\verb!\catcode`\-=11!: \\
\verb!\ce{[Ru(cod)( 2-methylallyl)2]}! & \catcode`\-=11 \ce{[Ru(cod)( 2-methylallyl)2]} \\
\verb!\ce{[Ru(cod)(\mbox{2-}methylallyl)2]}! & \ce{[Ru(cod)(\mbox{2-}methylallyl)2]} \\
\verb!\ce{[Ru(cod)(\text{2-methylallyl})2]}! & \ce{[Ru(cod)(\text{2-methylallyl})2]}
\end{tabular}
\end{document}
Edit 2017/05/30
The problem doesn't show with the current version of mhchem:
\documentclass{article}
\usepackage[version=4]{mhchem}
\begin{document}
\verb!\ce{[Ru(cod)(2-methylallyl)2]}! \ce{[Ru(cod)(2-methylallyl)2]}
\end{document}

chemmacrosyou would write\ch{[Ru(cod)( "2-methylallyl" )2]}– cgnieder May 06 '13 at 18:34