it's when i play the G note/3rd fret on the E string of a bass guitar.

it's the only one doing this.

and how can this be prevented from happening again?

You need to check these things really:
1. Nut - make sure that the string moves freely and it's not too low,
2. Frets - make sure the frets aren't high along any points below your E, are seated properly, and aren't worn,
3. Bridge - same as the nut, make sure the saddles are in good condition.

Edit: Pay particular attention to the 4th fret, which might be high.