\documentclass{article}
\usepackage{amsmath}

\begin{document}

\[
\fbox{$\sin(x)=0$}   % OK 
\]

\begin{equation}
\sin(x)=0   \tag{1}   % OK
\end{equation}

\begin{equation}
\boxed{\sin(x)=0} %\tag{1} %   %fails only with mathml
\end{equation}


\begin{equation}
\fbox{$\sin(x)=0$} \tag{21}    %fails only with mathml
\end{equation}

\fbox{hello}


\fbox{$\sin(x)=0$}


\[
  \fbox{$\sin(x)=0$}
\]


\begin{gather}
  \boxed{ q= c^2}\\
  a = b
\end{gather}

\begin{align}
  1 &=2\\
  \intertext{aaa}
  a+b&=c+d\\
  \intertext{dont't forget that \begin{equation}1=1\end{equation}}
  0.5&=\frac{1}{2}
\end{align}

\end{document}
