One way to do it might have been to build the ship to military standards, but as the
Lusitania's loss illustrated in gruesome detail, this is no gaurantee. She took a hit and sank in 18 minutes. Conceivably, as Erik indicated, extending the watertight bulkheads higher
might have done the trick. Likewise, eliminating the firemans tunnel and the boundry it penetrated by way of bulkhead B might have made a difference. Also, having watertight decks complete with watertight hatches might have made a difference.
There are a number of problems with this, not the least of which is ease of access to other parts of the ship which is a matter of convenience not only for the crew. but the fare paying passengers. One could have designed the Titanic so that it could have had literally thousands of individual watertight compartments but getting around would be so rediculously difficult, that passengers would book passage on far more comnfortable ships. In this sense, the Titanic would have been 100% safe as the only place she would have gone to is the breakers.
Even if passengers were willing to accept the inconvenience, there still would have been the matter of training needed in order to button the ship up and properly contain the damage. Warships have literally thousands of watertight and gas tight fittings which can be closed, but to do it right takes a years worth of constant training in a relentless workup schedule that mercentile crews don't have time for. Even then, there are always mistakes made and fittings that for some reason, just don't work.
In closing, if you take a look at the Britannic, you'll see a ship where all sort's of improvements were made over the Titanic vis a vis higher bulkheads a double hull, etc, but when she parked on a mine, she sank in an hour.
Cordially,
Michael H. Standart