At least a few bivalves have symbiotic relationships with potentially
unpalatable organisms such as sponges and corals. Cryptostrea permollis
lives in sponges, for example. Many large bivalves have clionid sponges
boring into their shells; conversely, some bivalves bore into corals.
Some boring bivalves secrete acids to etch away the substrate. This could
be used defensively, although I do not know of evidence that it is.
Hiding, being difficult to open or bore into, and running away do seem to
be the most common defenses of clams. Leaping (cockles, razor clams) or
jetting (scallops, limids) is probably most effective against slow-moving
predators like starfish and gastropods.
David C.