In Firefox go to Tools > Options > Privacy > Cookies
Click the small triangle next to cookies to expand that tab and put a check next to "for the originating website only". This will prevent third party cookies from being installed on your computer.
In IE go to Tools > Internet Options > Privacy and click on Advanced in the Privacy tab
Now put a check next to "Override automatic cookie handling"
Set first party cookies to Accept and third party cookies to Block
Also put a check to "Always allow session cookies" OK your way out.
If you are using another browser, you will have to find the settings in that browser to block those third party cookies..also Spywareblaster blocks most known bad cookies in both Internet Explorer and Firefox..I had posted it in my prevention speech..you can find the link above in that post..it is a very small program so it wouldn't affect performance much..