Saying 'no gift necessary, the pleasure of your company is the best gift' or something similar is fine to do. Some people will still bring gifts regardless, and that is also fine. Remember though, that if you ask for no gifts, you should put any gifts brought out of sight and definitely no gift-unwrapping during the party. That would be a slap in the face to anyone who actually respected your wishes.
In my extended family, all the kids are each getting two parties - a small one just with family (all our family is out of state, so that one is a whole-day event), and a second with the kids from the neighborhood/school/etc for a couple of hours. For the family party, I don't even try to stop the gifts, I just try to direct them a little to something my child could use/might like/we don't already have (all of us do this, so it is expected.) The grandparents have all switched to buying a little something and putting the rest of what they would have spent into the kids 529 accounts (or savings bonds, etc.)
For the friend's party, the last couple of years, I've specifically asked for donations of new or very good condition childrens' books to donate to a local shelter. I say "in leiu of a gift, please bring..." and that works out really well. You can ask for anything from stuff for kids (baby supplies, school supplies, books) to food for your local food bank. Pretty much everyone who is coming can at least bring a can or box of food with them. Emphasize that you are blessed with your friends and family's company, and you want to pass that blessing on through the donation...
Again, I don't make a big deal out of who brings what (and the few gifts that came went over to the side of the room, out of sight), and then everyone who came to the party got a "thank you for attending" note on the bookmarks I gave as favors. The gift-bringers got a longer thank you note later.
Saying 'no gifts' is fine, as long as you understand and are prepared for the folks who will bring them anyways. I certainly think that in this era of too much 'stuff' that it is an excellent sentiment.
(I'm off to go to the store to pick up something for a classmate of my daughter's birthday party this weekend now. <sigh>)