Passport is your most important possession while you're abroad so its vital that you know where it is at all times. To keep it secure while you're on the move, put it in a zipped pocket close to your body and then lock it in the hotel's safe or somewhere secure if you're self catering. If it gets lost report it to the local police and get a report. Or contact your embassies or consulate, where you'll be asked to provide the police report and fill in froms to cancel the passport. Depending on your travel plans and where you are in the world, you'll be issued with an emergency passport unfortunately, you'll have to pay some replacement fee on the spot for applying the emergency passport.
To avoid the hassle, check your passport if it is valid for the duration of your trip plan. Leave a photocopy of the page which shows your personal details and passport number with a family member and keep a spare copy with you.