At the beginning of my PhD, last year, I had several ideas, so after thinking long and hard about them, I suggested them to my supervisor. His most common answer was "that is a nice idea, they tried that in the 90's, it didn't work".
Later, I finished my first manuscript. I was quite proud of it, and I gave it to him for review. It came back with more red than black.
Also, don't forget the resources a professor can give you. As an undergrad, I had an idea for which I needed a couple of hours in a student lab using non consumable and safe equipment, but I wasn't allowed. I then suggested the project to a professor, and a word from him gave me full access to whatever lab I would need. Depending on your case, this may mean data, computers, or having a conversation with an expert in something you may be stuck with.
So, chances are that if you work by yourself, you will have the same problems. Either you will work on something irrelevant or some known dead end; and when you get a result, you will have a hard time putting it in a publication ready form. Take as an example your own question: you wrote one paragraph, and three people have already considered your post unclear. A several pages research article, where not even the researcher fully understands what is going on, is significantly more difficult.
You can, of course, go ahead and try to research something you find interesting on your own, but your chances of getting published are significantly lower than if you have a mentor. You would have to jump many more hurdles.