Sometimes people say "YOU CAN'T GET AN AGENT UNLESS YOU KNOW SOMEBODY!" or "YOU CAN'T GET AN AGENT UNLESS YOU ARE PUBLISHED!" - but we all know both of these are myths.
Newbies with no publication credits get agents (and book deals) all the time. But they aren't REALLY newbies of course... they might be unknown, so far, but they've been working on their craft for years. They are good writers. And, I'd venture to say, they've also been mindful of the agents' time and tried to put their best, most polished work out there, and been sure to follow guidelines so as not to sour good will or burn any bridges.
Let's say for each finished manuscript you want to query, you are given a "chit" of sorts. This chit gives you access to x-amount of an agent's bandwidth/time/patience, provided the agent is taking queries.
Since agents are generally benevolent creatures who really want to help writers, they are happy to accept the chit. However, since agents don't know you from Adam and you don't have "good credit" yet, this chit is for, at most, three minutes worth of time. (If you've been referred or you do have other work, the credit line is likely to be a bit longer - but everyone gets credit). Since you have so little time, you'll definitely want to be sure to have followed directions and submitted a really stellar piece of writing!
If the agent is simply not interested in the book, you'll get your same chit back. Better luck next time, no harm done, try again later with a new manuscript.
If the agent likes the book, they will go ahead and give you more credit on that chit. Depending on how much they like the work, you might get a few hours or even a day of credit.
If they end up liking the book but they don't sign it up, you'll get the chit back, likely WITH the extra credit included. Go ahead and use it again next time. Yay!
If the agent loves the book and you become a client, you get a bag full of chits back. You can use them to ask lots of questions, and your agent will likely encourage you to do so, but do BE AWARE: Middle of the night panicked phone calls at home for no good reason WILL cost more than reasonable questions asked by email in the light of day. That being said, the longer your agent knows you, the more you work together, and the more sane you are in general, the bigger credit line you will get (so when you DO have a legit cause for a panicked phone call, don't worry, you'll get heard!)
If your manuscript is riddled with errors, you have clearly never read the submission guidelines, or your work seems like a monkey might have typed it... you might not get your chit back. You can rebuild credit, but it is going to take a while, and you're going to have to submit something different in truly stellar shape next time.
If everything is OK but you pull a weird stunt like re-sending multiple slightly revised versions, or they request the full and you send it but then snatch the manuscript away from them as they're reading it, or they ask for revisions and you say you're on board but then nothing is actually changed... well. Again, you've cashed in your chit. It will take a while to get that line of credit back. It can be done, but it isn't going to happen overnight.
If you reveal yourself to be a class-A jerk by doing something like responding to a civil form rejection (or frankly ANY kind of rejection) with vitriol or threats - you cashed in your chit for good. In fact, you set your chit on fire. No more credit for you ever. (But what do you care, right? You have to know you are burning bridges when you send an email like that.)
PLEASE NOTE: THERE AREN'T REALLY QUERY CHITS. (But man, wouldn't life be easier if there were?)