score:33
First of all, Monaco was annexed by revolutionary France and was part of it from 1793 to 1814.
Before 1793 and from 1814 to 1860 it was surrounded by lands belonging to the House of Savoy. (So for those specific timeframes, it would be pretty hard for France to annex Monaco without annexing Savoy's lands).
Monaco was surrounded by France from 1860 as a consequence of Treaty of Turin. Two years before, France had agreed to help the Kingdom of Sardinia (ruled by the House of Savoy) fight the Austrian Empire (Second Italian Independence War), and the price for this help was the Duchy of Savoy and the County of Nice.
Monaco was not annexed by Savoys before 1860, because its independence was guaranteed by France (Treaty of Peronne).
The later relation between Monaco and France was regulated by a treaty of 1861, when France guaranteed Monaco's sovereignty in exchange for the towns Menton and Roquebrune.
And why did France not try to annex Monaco? Maybe because Monaco is France's client state anyway: France controls its foreign affairs and may interfere with the succession issues, see Monaco Succession Crisis - so why annex it at all?
The other reason that comes to mind is that Monaco's existence as an independent state, attracting tourists and rich folks from all over the world, is beneficial to the whole South French Riviera economy, but this is a somewhat controversial statement.
And finally, addressing your question about the nationalism, if we only take a look at the languages: the Monagesque dialect is of Ligurian origin, but the local population through the time felt a rather strong local identity: during the revolution people threatened the Prince with establishing a republic, not joining France or Italy - in other words: it seems that the Monagesque people have never really desired to be a part of either France or Italy.
Upvote:2
In 1641, France and Monaco signed the Treaty of PΓ©ronne, by which Monaco became a French protectorate in return for French guarantees to the House of Grimaldi's sovereignty over the principality. Ignoring the treaty and invading Monaco could have been done, but wouldn't have been worth it to France (Monaco at this time was not the super-rich place it is now).
Upvote:3
Monaco was initially an Italian principality. It was founded by Genoa, and later became a colony of Spanish "Aragon," which took over large chunks of Italy. In the 19th century, after the French Revolution, it became a part of Sardinia. It was Monaco's association with "Italy" that tended to keep it out of the hand of France.
In fact, most of the original Monaco was sold to France for money by its Prince in 1861, but he kept a small city-sized piece that included the most nationalistic, independence minded "Monacons" who spoke Ligurian, an old Italian dialect. It became the site of a casino, and therefore a playground for the rich, and thereby a (small) "power" in its own right.