No rule for this one
No ending or word group predicts the article of Herr. Learn it as a pair and say it out loud: der Herr.
der Herr
It's der Herr. Herr is masculine, plural die Herren.
Das ist Herr Müller.
This is Mr Müller.
No ending or word group predicts the article of Herr. Learn it as a pair and say it out loud: der Herr.