It's important to have purpose in training. It's important to come in focused and mentally prepared to work. It's important to know what you're doing, and to pay attention to your body. Because if you're not prepared, purposeful, and focused, you end up with junk.
Junk miles are miles (or meters, or yards) that don't matter. They don't contribute to your overall fitness or to your specific sports-related fitness; they just make you tired and frustrated. Which isn't to say that every time you work out it needs to be targeted towards improvement; there's still room for running because it's fun, or swimming because you enjoy it. There's still time for pleasant bike rides with family or friends and hanging out at the pool.
One of the automatics for junk miles is working out too much. There's some research which has shown that you need at least three workouts a week to improve significantly, but that more than five workouts a week doesn't really do much; five is kind of the maximum for how much you'll improve. In triathlon, this means you're going to be doing nine to fifteen workouts a week. But if you're doing more than that, it's sort of automatically junk.
Another type of junk miles I've run across in my own experience is going into a workout with no real clue as to what the purpose of the workout is. I find that I'm especially susceptible to this in led swim workouts, for several reasons. First of all, I have very little face time with the coach; my face is in the water for most of the workout, and the coach is often walking up and down the pool, watching everyone (some coaches are better about individual work than others, of course). Also, very rarely do my coaches tell me what the purpose of the workout is, which is exacerbated by the fact that they often reveal the sets as we swim them, rather than laying out the whole workout on a blackboard (I know that these problems are pretty specific to my Masters program, also; in swim class, we often have the entire workout written out for us). The point is that if I know that I'm doing an intervals workout, or a power workout, or a speed workout, then I know how to orient myself; I know how to use my muscles to achieve that goal. But if I don't know the point of the workout, I'm much more likely to swim (or run or bike) along without really paying attention.
Which brings me to my final point: focus. Your body gives you feedback, as you work out. I've found that my workouts are much more effective when I'm concentrating on the tast at hand rather than thinking about lunch, or planning my weekend, or whatever. For example, on Sunday, towards the end, I found it harder and harder to focus. My mind wandered to various things, my pace slowed, and I hurt more. But when I pulled my attention back to my running, I was able to maintain a better pace, a faster cadence, and a better form. Plus, it's harder for your body to trick you into thinking it's too hard to go on. (A brief note is that I think it's find to workout with another person and chat as you do it, as long as you can maintain proper form, because the other person will often push you to run harder by their very presence).
So how do you avoid junk miles? Plan your main workouts with a warm up, a main set, a cool down, and a purpose. I have different categories of workouts, like Speedwork, Technique, Power, Endurance, Base Building. If you go into a workout knowing what you want to accomplish, you're more likely to accomplish it. During the workout, focus on what you're doing and try to keep your mind from wandering to random things (like food, which is where my mind usually goes). Finally, eating right and sleeping enough also go a long way to making each workout as effective as it can possibly be.
Time can be tight for triathletes. We have three sports that we're preparing for all the time, plus we have specialized things to practice like transitions and open water swimming. Make sure the time you spend on training is as effective as possible.