Dry ice is hazmat because it sublimates into carbon dioxide gas which displaces oxygen. In an enclosed environment, without adequate ventilation, it can cause illness, unconsciousness, and even death. To carry dry ice safely, the total amount onboard is limited based on the cabin size and ventilation characteristics of the airplane. Dry ice and live cargo must also be kept separated. This is why it is important for the airline to know about all of the dry ice that is onboard.
Back in the 1990s, I knew of an incident with a cargo DC8 that diverted due to weather. The crew waited out the delay in the airplane but forgot about the dry ice they were carrying and didn't maintain adequate ventilation. The three crewmember ended up in the hospital suffering from CO2 poisoning.
Please don't bring undeclared dry ice onboard an airliner.