How can i do the following I have duplicates of the same prefab in the scene. Each of these prefabs has a script with a function called DestroyObject, when called this function removes the object it is connected to.

How can a call the function in the script on the object that is hit by a raycast, and only have the one prefab that is hit by the raycast have its DestroyObject function called and subsequently be destroyed, while the rest of the duplicates of the same prefab are unafected.

assuming you have a RaycastHit variable from a raycast:

var destroy : DestroyObject = hit.transform.GetComponent(DestroyObject);
if (destroy != null) destroy.DestroyObject();