I want Glass to be transparent where nothing exists So I am making something for a video overlay. It should be semi-transparent to allow some of the video to be seen through it.

This was not a problem at first. The item was a glass ellipsoid with text (opaque) and other objects (opaque) in front of it which casts shadows and reflections. Using glossy surface and playing with roughness and also adding a transparent shader (mixed shader) did the trick.

Now the project includes putting something opaque behind the glass which should be diffracted through it.

Transparent shader does not diffract what is behind it. The glass shader does but once it is introduced, I lose all transparency in the glass.

Adding a mixed-shader with transparency gives a diffracted and non-diffracted view of behind. Adding a mixed-shader with holdout makes the ellipsoid and its diffractions semi-transparent, even so the opaque object is now semi-transparent (though the glass). Also tried refraction shader. Same issue as glass.

What I am trying to do is make anywhere where no light hits the glass (environment transmissions/reflections, refractions) are all transparent but opaque objects in front and behind the glass are still opaque.

Blender 2.73a, Cycles. Nodes.
One way you could do this is by using a sort of "greenscreen".


Add a big sphere which encloses the entire scene, and give it a material which will only be visible when seen directly through a transmissive material. Also disable visibility for unwanted ray types:


Put the sphere on it's own layer (I put it on layer 2), and create a second renderlayer which excludes it:



The first renderlayer is identical except for the Exclude setting.
Use the compositor to turn the green channel of one renderlayer into the alpha channel of the other:








If there is already red green and blue in your scene, you could try using the compositor to turn the difference between the two renders into transparency:





However you may need to tweak things to get it to work as desired.