This is an excellent question. Consider the following verses:
Genesis 6:17 - "And, behold, I, even I, do bring a flood of waters upon the earth, to destroy all flesh, wherein is the breath of life, from under heaven; and every thing that is in the earth shall die."
Genesis 7:15 - "And they went in unto Noah into the ark, two and two of all flesh, wherein is the breath of life."
Two factors need to be considered. First, God destroyed those creatures that have the "breath of life." This would exempt those that breath through gills. Second, God destroyed all flesh "upon the earth;" see also Genesis 7:4 which states, "every living substance that I have made will I destroy from off the face of the earth." This refers specifically to land animals and not to creatures that live in the waters. Therefore, even creatures like whales that breath the breath of life would be excluded because they do not live upon the earth. Clearly, enough of these creatures would be able to survive the flood so as to make their preservation in the ark unnecessary.
Another way to consider it is to look at the kinds of animals God made in the first chapter of Genesis and the kinds that are taken on the ark. Five kinds of animals are created: fish, fowl, beasts, cattle, and creeping things. In Genesis 7:14, God lists the categories of animals taken on the ark: "They, and every beast after his kind, and all the cattle after their kind, and every creeping thing that creepeth upon the earth after his kind, and every fowl after his kind, every bird of every sort." You will notice that four of the five categories are mentioned with the fish being left out. They were not included.
One final note: God classifies animals according to habitat. He is not required to use our modern classification system. In His classification system, a fish is something that makes its major habitat in the element of water. Therefore, whales are included as fish (Genesis 1:21). We cannot take a classification system designed about two hundred years ago by man and use it to correct the biblical system written over three thousand years ago.