Not sure if this is the right place to post this question. When I was twenty I sent off a book to be published and got a not-what-we're looking for rejection. It didn't exactly floor me because the more I looked over my story, the more I realized it wasn't something from the heart, but instead was a lousy imitation of a hundred better ya books. My writing has improved but there's still doubts. Just wanted to know if there's ever a point when you know your good enough to sell something, or do you always feel like your taking a chance?
This may sound like a flip answer, but that is not my intention. You will know you're getting close when you begin getting rejections with specific comments. You know you're ready when you get acceptance letters, even provisional ones ("If you change this, this, and this, feel free to send me an updated MS").
If all elements of a story are found in whatever it is you are writing then that is the time you'll know that your work is ready for publishing...
I think there's always an element of chance/risk - you're sending your baby out for people to read and say if they like it, and even the best writers got rejections. I agree with Cog, but that only means one thing - that is, you must submit your MS no matter what, because until then you won't know what kinda rejections you'll be getting, and therefore just how close you are.