I am prepared to be contradicted, however I have to say that according to my understanding, if the Prince of Wales died before he became king, his children being High and Mighty Princes would become princes with the prefix, The. This is a convention rather than a law - as are most royal decrees - within the peerage sons and daughters of Dukes have the prefix, The before lord or lady to distinguish them from children of marquises and earls. If a distant cousin inherited a dukedom, the sovereign usually gives permission for his brothers and sisters to have the courtesy title of e.g. The Lord John Smith and the Lady Mary Smith. John Smith, if married his wife would be The Lady John Smith.
If The Prince Andrew remarried and had a male heir he would be styled, prince. By current trends he may be styled Lord Inverness, but traditionally he would inherit the dukedom of York, and his son would be Earl of Inverness. Very few royal dukedoms last more than three generations for some reason, by which time they have moved directly out of the royal circle. The only royal dukedoms to survive in the direct line from the 18th and 19th centuries are those of Cumberland, and of Albany. However, in 1917 King George V abrogated British titles which had devolved upon his cousins, then German nationals.