What are the disadvantages of having postdocs or visitor in the lab? I have seen professors clearly stating that they do not accept visitor students or postdocs.

So, what are the disadvantages of having such positions?
This can vary a lot from professor to professor or even school to school. Some ideas:  


Cost. This varies heavily from school to school. At some schools, tuition is waived for graduate students but not for visiting students, and the professor would have to pay tuition for a visiting student. If tuition is waived and the professor only has to pay the research stipend, the graduate student stipend is typically cheaper than the postdoctoral stipend. If visiting students come from abroad, there can also be immigration costs and living stipend requirements that the professor must provide for. 
Training time vs. research produced How long it takes to train someone varies from field to field. In my field, it's probably about a year of training before you can really pull your own weight. If you're a visiting student who will only be here for one year, you might be a net-drain on the research production in the group: we spend a lot of time training you, and then you immediately leave. What do we get for that sunk time? 
Fear of being scooped. Less so for a postdoc, but with a visiting student present for a short time, some professors in highly competitive fields might be concerned that the visiting student will go back to their "main" lab and work on very similar projects, potentially scooping the group that hosted them. 
Desire to focus on graduate students. Some professors especially later in their career, enjoy mentoring and working to develop new scientists. Often you see the most progress and development from graduate students, who are with you longer and have had less training. For some professors, this can be very gratifying. 
Minimizing group turnover and recruiting. Some professors might prefer to have students for longer periods of time, to allow them to focus more on research and less on the periphery of recruiting and training new members, especially if professors are retired or near retirement. Graduate students are typically around for 4-7 years, whereas visiting students may be around for as little as 8-10weeks, or postdocs only 1.5-3 years. 
Transitioning into retirement. Some professors when they are considering retirement will try to focus exclusively on getting their last few graduate students finished with the program. (On the other hand, some professors might prefer postdocs who could more easily be pushed off into a job whenever they decide to retire.) 


Edit: If you're seeing this on a website, the professor may not have a standing rule against visitors or postdocs, but may simply not have room or funding for them right now.