What are the merits of an inlet cone/spike/centerbody vs. a 2D inlet?
Both are ways to create compression shocks in order to compress and decelerate supersonic air.
Spike intakes
The central spike is characterized by:

undisturbed flow,
light weight and compactness, and
easy adjustability to speed and mass flow at high flight speeds by translating the spike.

Its disadvantages are:

large loss of efficiency with angle of attack and sideslip,
long internal ducting,
limited space for radar installation, and
limited mass flow at low speed.

Typical central spike intakes are those of the MiG-21 or the SR-71, as shown below. Note the variation in cone angle which helps to create additional, steeper shocks such that the flow is gradually decelerated over a sequence of shocks. The inside is filled with a radar system or hollow in case of the SR-71. At the height of the intake lip the SR-71 spike has a perforated wall to suck away the spike's boundary layer, and aft of that it contains the translation mechanism which shifts it back and forth to adjust the intake cross section and to adjust the shock position.

A variant of the central spike is a side intake with a compression half-cone, as used on the Mirage III, the F-104 Starfighter or the TSR-2. Their location at the fuselage side helps to reduce the length of internal ducting and to reduce flow distortion due to sideslip. It also frees up space at the fuselage tip for a larger radar antenna. However, now the fuselage boundary layer has to be split off by a splitter plate to ensure equal flow energy over the whole intake cross section.
The picture below shows the English Electric Lightning with its central spike intake feeding two Rolls-Royce Avon engines, and the side intake of the TSR-2. Note the additional intake doors aft of the intake lip of the TSR-2 which were needed to increase mass flow at low speed.

The F-111 has a quarter-circle spike intake. Here, the wing root also helps to direct the flow, so angle-of-attack variations produce less intake flow distortion. To suck away the intake boundary layer, the spike is perforated at the lengthwise position of the intake lips.

Ramp intakes
What you call 2D-intakes are normally rectangular with an oblique shape. The forward edge is used to create an oblique shock which can be positioned to hit the rearward edge on the opposite side by shifting one or both edges up and down. This also changes the cross section of the intake, so adjustments for mass flow can be made over a wide range. An adjustable ramp aft of the forward edge allows to create more shocks with decreasing obliqueness, such that the flow is decelerated by a sequence of shocks. Typical ramp intakes are those of the F-14, the F-15 or the Concorde. Their advantages are:

Adaptability over a wide range of flow conditions, angles of attack and mass flows, and
tailoring of the shock system for optimum efficiency over a wide range of supersonic speeds.

Their disadvantage is a consequence of the wide adaptability:

High weight and complexity.

Note that the pressure in the intake is a multiple of outside pressure at supersonic speed, so the intake is actually a pressurized duct. A rectangular intake will need massive structural reinforcements to stay in shape while the cross section transitions to a round shape downstream.
The drawing below shows the intake of the F-14 at different flow conditions. Note that the sharp intake lips require them to be exactly aligned with the local flow direction to avoid flow separation.

While a central spike intake is the best choice for flying at the design speed, the rectangular intake works better over a wide range of speeds. The shift in air combat doctrine from flying as fast as possible (1950s) to flying mostly subsonic with brief supersonic dashes (since the 1970s) is reflected in the choice of intake type.
Hypersonic intakes
When flying at Mach 5 and above, the obliqueness of the shock waves will need a very long intake, and effective designs use the lower side of the forward fuselage as part of the intake to create the necessary sequence of shocks for pressure recovery. Now the fuselage nose becomes the forward lip of the intake, and the body is shaped to create ever steeper shocks. Alternatively, the lower forward fuselage is shaped to work like a section of a spike. What looks like the actual intake is actually the rear intake lip, and the divergent section of the intake aft of the rear lip is reduced since the flow in the combustion area is still supersonic in order to keep temperatures manageable, making the engine a scramjet. This answer has more information on supersonic combustion.
Note that this type of intake is optimized for one speed, and very little adjustment is possible. The pictures below show a NASA CFD study of the X-43A (left, source) and the Russian Ajax project (right, source). A scramjet can use both types of intake, and the fuselage design will determine which type it will be.

The rear fuselage now becomes the nozzle of the engine, because most of the expansion will happen after the flow leaves the enclosed part of the engine.