Is it generally possible to apply for a visa to another country from a country that is not my country of origin? As a concrete example to clarify, I have a German passport and I can travel without applying for a visa beforehand through France, Spain, Morocco, Western Sahara, Mauritania, Senegal, Gambia and Guinea-Bissau, but in order to enter Guinea, I need to apply for a visa. Is it possible to do this from Senegal (for example)? Also, which embassy will be responsible for that?
The answer to the broader question, can you apply for a visa from a country other than your home country, is MAYBE.
Each country has different rules for visa application procedures. Some restrict you to applying in your home country, some allow you to apply from another country if you have residency status there, some allow you to apply from another country if you are visiting with the proper visa, some could care less where you apply from. There is no universal rule.
A couple of ways to determine this would be:
visit a visa handling agency such as CIBT, etc who have offices and agents all over the globe. Their visa inquiry forms often allow you to note where you are currently located;
do a web search for your destination's embassy in the country you plan to apply for the visa from, but keep in mind you may be searching for "Embassy", "Consulate", "Honorary Consulate General", as not every country maintains a full diplomatic mission in each country of the world.
For most countries you can get a visa at any of their embassies. But, not all countries have embassies in every country. Sometimes, this is resolved by them allowing you to send your passport to them, them adding their visa to your passport and them, then, sending your passport back to you. I highly advise against doing this in Africa, were postals systems are, at best, unreliable.
Guinea appears to have an embassy in Senegal:
It appears straightforward to get a visa for Guinea:
Also check out CIBITvisas. They don't have linkable country pages, though.
Note that you might be required to show proof of yellow fever vaccination on entry or when applying for your visa, or both.
While you've specified a few countries, I guess the actual question - can you apply from a country other than your own (ie on the road) can be answered: NO.
For example, Russia (which also requires an invitation) requires that you apply for a visa from the embassy in your country of citizenship or residency. So both times I went there, as a NZ Citizen living in the UK, I had to apply from the London embassy.
The second time, especially, I would have preferred to apply enroute, but they weren't having any of it. Others were pretty good though, from London to Mongolia the only other one I had to get in advance was Uzbekistan, and while I got Tajikistan back in London I could also have picked it up (and did for a second one) while in Uzbekistan.
EDIT (oops had read Senegal). Guinea - you can indeed go to the embassy in Dakar, Senegal. From that page, it looks like you would also need a vaccination booklet (the yellow ones) to prove you've got the relevant vaccines (eg Yellow Fever), and if they're like Senegal, a biometric passport (although I think Germany has had those for quite some time)
To answer the lead question directly: It's definitely possible and very common to apply from another country than your country of origin/citizenship. But many countries do require that you apply from your place of residence, so it's not always possible to apply from a random third country.
In practice, it means the consulate wants to see a residence permit or some long-term visa or proof of address, which makes it impossible to apply “on the road”. It is by no means a general rule however, some countries do not care or have more haphazard practices (with some consulates being “easier” than others). So it might still be possible in some cases but you can't rely on it.
For Guinea specifically, I don't really know. I found many forum posts in French suggesting that getting a visa from Bamako or Rabat is quick and easy, not sure about Dakar. At least, there is no strict requirement to get it from your country of residence. As others have already explained, a proof of yellow fever vaccination is required.
If you are just travelling, the answer is very likely NO. Most embassies/consulates accept visa applications from citizens of countries other than the country they are in, but only if these people actually live in the area that the embassy/consulate serves legally, i.e. the person is a permanent resident or on a student, working, asylum, etc. visa. However, if you don't fit these conditions, it is very unlikely that the consulate/embassy will accept your visa application. Therefore, you will very likely need to apply for the visa in Germany.