You could add \ignorespaces
to your definition to ignore spaces at the beginning of the environment:
\documentclass{article}\usepackage{amsthm} \renewenvironment{proof}[1][Proof]{\noindent{\bfseries #1.\ }\ignorespaces}{\qed\\[2mm]}\begin{document}\begin{proof} $A = X$.\end{proof}\begin{proof}[Proof] $A = X$.\end{proof}\begin{proof}[Proof]% $A = X$.\end{proof}\end{document}
But IMHO using \ignorespaces
is mostly a workaround. So I would recommend to use a solution like @daleif's answer instead.