I think that the best approach is to use the "real apostrophe" ’ in text, so the definition as \mbox{'} can coexist peacefully with the usage of ' in math. Saying
\DeclareUnicodeCharacter{2019}{\mbox{'}\hskip 0pt \nobreak}
will allow hyphenation of the word following the apostrophe. However you'll miss the '' ligature for closing double quotes.
Here's a code I wrote for a similar problem (see this discussion on the GuIT forum):
\makeatletter
\edef\qu@te{\string'} % save a copy of the ordinary apostrophe
\catcode`'=\active % make ' active
%%% Update \@resetactivechars (that shouldn't act on ' any more)
\begingroup
\obeylines\obeyspaces%
\gdef\@resetactivechars{%
\def^^M{\@activechar@info{EOL}\space}%
\def {\@activechar@info{space}\space}%
}%
\endgroup
%%% In case hyperref is not used
\providecommand\texorpdfstring[2]{#1}
%%% Define the active '
\protected\def'{\texorpdfstring{\texqu@te}{\string'}}
\@ifpackagewith{inputenc}{utf8}
{\DeclareUnicodeCharacter{2019}{\texqu@te}}{}
\def\texqu@te{\relax
\ifmmode
\expandafter^\expandafter\bgroup\expandafter\prim@s
\else
\expandafter\futurelet\expandafter\@let@token\expandafter\qu@t@
\fi}
\def\qu@t@{%
\ifx'\@let@token
\qu@te\qu@te\expandafter\@gobble
\else
{}\qu@te{}\penalty\@M\hskip\expandafter\z@skip
\fi}
\scantokens\expandafter{%
\expandafter\def\expandafter\pr@m@s\expandafter{\pr@m@s}}
\makeatother
In math mode ' should have the same meaning as the math active, that is, \active@math@prime which means ^\bgroup\prim@s; in text mode we have to check whether another apostrophe follows. I use \futurelet directly in order not to swallow spaces with \@ifnextchar.
If the apostrophe has to be set, I use {}'{} to defeat the kerning (which probably won't work in LuaLaTeX).
The final \scantokens is just to redefine \pr@m@s under the current catcode settings without copying its definition from the LaTeX kernel.
{'}. – Speravir Sep 13 '12 at 1:28