Oysters especially do not open as easily as clams do when cooking. If the shell remains shut after cooking, that just means the muscle that holds the shell together is working!
Sometimes that means it’s still alive and just hasn’t been cooked enough to die yet, or the muscle is so joined to the shell that it’s not letting go even after cooking and killing the oyster.
Sometimes it takes a shucking knife or butter knife to get them to open.
You can absolutely get an oyster that hasn’t opened up and it’s gone bad, but the smell is telling if that is the case (you would know it!).
In the rare case where you have a dead one, you would definitely notice that it didn’t look like the others even after being cooked… it wouldn’t be as plump. And again: that smell!