It is okay to say یا رسول الله.
The word "یا" means "O" which only can be used if somebody is in front of you. If I say "یا الله" then it is okay because Allah is everywhere so I can say this but should I say "یا رسول الله" because our Prophet Muhammad (SAW) is not in front of us.
I am asking this question because their are two mosques in my area and in both mosques "یا رسول الله" is written along with "یا الله" so one of my cousin refuse to offer pray in these mosques because he "my cousin" said "my prayer won't be accepted if I offer my prayer in these mosques".