I was looking at some German passport (see the bottom of the picture below) and it says:
Countries for which this passport is valid: for all countries.
This makes me wonder: Are some passports only valid in some countries?
Yes, many passports are only valid in some countries. For example, my Italian passport issued at the Consulate General in New York City states that it is only valid for countries recognized the Italian government. I don't believe this is enforced, otherwise we would hear stories about people being charged for visiting northern Cyprus.
My US passport also states "Use of this passport ... for travel to countries where a US passport is not valid is a felony". Valid countries are not listed, but the US State Department website states that "U.S. passports are not valid for travel to, in, or through North Korea, unless they are specially validated by the Department of State."
Libya is another example of a Muslim country where passports are marked as valid for travel to all countries except Israel:
The Israeli government doesn't necessarily deny entry if a passport is marked as not valid for Israel. E.g., from wikipedia.org:
Although Malaysian passports bear the inscription "This passport is valid for all countries except Israel" and the Malaysian government officially allows travel to Israel for Christian pilgrims only, the travel restrictions imposed by the Malaysian government have no bearing on the Israeli government, which issues visas to Malaysian citizens according to Israeli regulations.
Another example from wikipedia.org:
Previously, Malaysian passports were not valid for travel to various communist countries, and South Africa due to its apartheid system. Following the fall of communism in Eastern Europe and improving ties with the remaining communist countries, as well as the end of apartheid in 1994, the countries were removed from the list.
From what I understand, if you have a South Korean passport, traveling to North Korea isn't really an option. South Koreans need special permission to enter the North. Something about the two governments still technically being at war makes border crossings a no-go with just a standard South Korean passport.