Posted earlier but I wrote it incorrectly.

How fast would a rocket have to be going in order to completely leave the solar system? (Assume that the Sun is the only mass in the solar system and that the rocket is beginning its journey from Earth's orbit?)

With the earth being the only planet in the solar system, the final velocity of the rocket, perpendicular to the earth/sun radial, would need to be

Vesc= sqrt2(4.68772x10^21)/93,000,000(5280)) = 138,177fps = 94,212mph.

Since the earth's velocity around the sun is 66,618mph, the rocket's orbital velocity of ~25,000 and the velocity of 912mph acquired from the earth's rotational speed at KSC Launch site, the rocket need only provide a final burnout velocity of 26,682 mph.

You might find the following of some interest.

How long is a round trip to mars?

It depends on the configuration of the planets at launch, the size of the rocket, and the weight of the payload. It could be as long as 970 days or as quick as 240 days. The following will explain this in more detail.

The time for a space probe, launched from Earth, to reach the planet Mars, or any planet for that matter, is a function of the location of the planets relative to one another at the time of launch, the final velocity of departure from earth orbit, and the velocity direction, at burnout of the rocket stage. The exact phasing and distances of the planets from each other, dictates the required magnitude and direction of the velocity. There are fundamentally two extremes to examining the time required to travel to a planet in a direct planet to planet flight. One requires a minimal expenditure of rocket energy but results in the longest trip time. The other requires a huge expenditure of rocket energy but results in a shorter trip time, relatively speaking.

The minimum energy, one way trip time, is ~259 days (assuming the average radii of the Earth's and Mar's orbits) while the fast track approach could get you there as fast as 70 days or less, depending on the final burnout velocity of the rocket stage. It is also possible to launch at a non-optimum phasing of the planets and take longer than the 259 days, such as the recent Mars Global Surveyor, which took ~10 months to arrive at Mars in September 1997. The Pathfinder spacecraft, traveled on a fast track trajectory, reaching Mars in ~7 months, on July 4, 1997. The following will hopefully shed some additional light on the subject for you.

The minimum energy approach for a probe to reach any planet on its own is by means of the Hohmann Transfer Orbit. By minimum energy, I mean the lowest possible final velocity of the probe as it departs its earth orbit. The Hohmann Transfer Orbit (HTO) is an elliptical orbit that is tangent to both of the orbits of the planets between which the transfer is to be made. In other words, a probe placed into a heliocentric orbit about the Sun would leave the influence of the earth with a velocity vector tangent to the earth's orbit and arrive at the destination planet's orbit with a velocity vector tangent to its orbit. One of the focii of this elliptical orbit is the Sun and the orbit is tangent to both the Earth's orbit and the target planet's orbit.

Lets explore what it takes to send a space probe to Mars. Lets assume a launch vehicle has already placed our probe and its auxiliary rocket stage in a circular, 250 mile high, low Earth orbit (LEO) with the required orbital velocity of 25,155 feet per second, fps.
By definition, a probe being launched on a journey to another planet, must be given sufficient velocity to escape the gravitational pull of Earth. A probe that is given the exact minimum escape velocity, will depart the Earth on a parabolic trajectory, and just barely escape the gravitational field. This means that its velocity will be approaching zero as its distance from the center of the Earth approaches infinity. If however, we give our probe more than minimal escape velocity, it will end up on a hyperbolic trajectory, and with some finite residual velocity as it approaches infinity, or the edge of the Earth’s sphere of influence. This residual velocity that the probe retains is called the "hyperbolic excess velocity." When added to the velocity of the Earth in its orbit about the Sun, the result is the heliocentric velocity required to place the probe on the correct Hohmann transfer trajectory to rendezvous with Mars
.
It is worth noting at this point that it is somewhat naive to talk about a space probe reaching infinity and escaping a gravitational field completely. It is somewhat realistic, however, to say that once a probe has reached a great distance (on the order of 500,000 to 1,000,000 miles) from Earth, it has, for all intensive purposes,
escaped. At these distances, it has already slowed down to very near its hyperbolic excess velocity. It has therefore become convenient to define an imaginary sphere surrounding every gravitational body as the body's "sphere of influence", SOI. When a space probe passes through this SOI, it is said to have truly escaped. Over
the years, it has become difficult to get any two people to agree on exactly where the SOI should be located but, nevertheless, the fictitious boundary is widely used in preliminary lunar and interplanetary trajectory studies.

As stated earlier, a probe that departs from a 250 mile high LEO with the minimal escape velocity of 36,605 feet per second will end up at the edge of the Earth's SOI with near zero velocity and remain there forever. We must then give our probe a final Earth departure velocity in excess of minimal escape velocity. Lets back into this required velocity in the following manner.

The final heliocentric velocity required by our probe for a Hohmann transfer orbit to Mars is ~107,350 fps, relative to the Sun. Since the probe, at the beginning of its journey, picks up and retains the velocity of the Earth about the Sun (97,700 fps), we can subtract this from our required heliocentric velocity to determine our required hyperbolic excess velocity. Thus, 107,350 - 97,700 = 9,650 fps, the hyperbolic excess velocity required by our probe at the edge of the Earth's SOI. To achieve this hyperbolic excess velocity, on the hyperbolic escape trajectory from our 250 mile high parking orbit, requires a final rocket burnout velocity of 36,889 fps, relative to the Earth. The velocity vector must nominally be perpendicular to the radius from the Sun, through the center of the Earth and parallel to the Earth's direction around the Sun. Since our circular parking orbit velocity is already 25,155 fps, we need therefore only add a velocity increment (delta V) of 11,734 fps with our auxiliary rocket stage burn.

Our launch vehicle has already delivered us to our 250 mile LEO. The auxiliary stage now fires, imparting its impulsive velocity change of 11,734 fps to push us out of the circular orbit onto our required hyperbolic orbit from which it escapes the Earth altogether. The journey would take ~259 days to travel the 180 degrees around the Sun and arrive in the vicinity of Mars. Using the more exact perihelion and aphelion distances for Mars, ~128,416,000 miles and ~154,868,000 miles, and ~93,000,000 miles for the Earth's distance from the sun, the Hohmann Orbit Transfer trip times would be ~238 days and ~281 days respectively. Obviously, the phasing of the planets is important for this type of transfer and the launch must occur at a carefully predetermined time such that both Mars, and the probe, will reach the heliocentric rendezvous vicinity at the same time.

The disadvantage of this type of trajectory is that when the spacecraft has reached Mars, the earth is too far past the position from which a reverse Hohmann Transfer trajectory could return the spacecraft back to earth. So the spacecraft would either stay in this elliptical trajectory until such time as the earth might meet up with it in the future or it could be placed into a permanent orbit around Mars. Obviously such a mission would be unmanned.

If it was desirable to place a manned spacecraft into a Martian orbit after a Hohmann Transfer trip to Mars, and eventually return it to Earth, they would have to remain there for 450 days until the planets were in the exact reverse configuration that would allow a return Hohmann Transfer trajectory back to Earth. Needless to say, such a mission would require a huge amount of life support equipment and supplies and last a total of 970 days, or 2 years, 7 months and 24 days.

If bigger rockets were available to deliver the spacecraft out of earth orbit, it could reach Mars in shorter times during what is called opposition class missions. The planets are considered in opposition when the Sun, Earth, and Mars are all on a straight line and the Sun and Mars are on opposite sides of the Earth. One version of such a mission could take a total of 240 days. The outbound trip time would take 120 days with the spacecraft reaching Mars at opposition, passing Mars by and returning to Earth in the reverse of the trajectory it took to get to Mars in the first place. This would take a bigger delivery rocket than that required to send the spacecraft on a Hohmann Transfer trajectory. Another version, also taking a total of 240 days, is one where the spacecraft goes into Martian orbit for 30 days and then returns to Earth. The outbound trip in this case would require 105 days and the spacecraft would reach Mars 15 days before opposition, go into orbit around Mars, explore for 30 days until 15 days after opposition, and then depart Mars on a 105 day return trip. This mission, though taking the same 240 days to complete, would require a still larger upper stage delivery rocket as the trip time is further reduced to 105 days. Clearly, there are other, more expensive, choices of departure velocities for even shorter trip times. The choice is primarily a function of how much money one is willing to spend on a launch vehicle and the launch site hardware.

To calculate the speed required for a rocket to leave the solar system, we need to consider the concept of escape velocity.

Escape velocity is the minimum speed an object must reach to overcome the gravitational pull of a celestial body, such as Earth or the Sun, and escape its gravitational field. It enables an object to overcome gravitational attraction and move away indefinitely.

In the case of your question, let's assume we want to calculate the escape velocity from Earth's orbit to leave the solar system. However, it's important to note that there isn't a precise boundary between the solar system and interstellar space, so we'll consider the outer reaches of our solar system as a rough estimate.

The standard reference distance used to define the boundary of the solar system is the heliopause, which is roughly located about 120 astronomical units (AU) from the Sun. One AU is the average distance between the Earth and the Sun, approximately 93 million miles or 150 million kilometers.

To calculate the escape velocity, we can use the formula:

v = √(2GM/r)

Where:
v = escape velocity
G = gravitational constant (6.67430 × 10^-11 m^3 kg^-1 s^-2)
M = mass of the Sun (1.989 × 10^30 kg)
r = distance from the center of the Sun (converted to meters)

So, substituting the values and converting units:

r = 120 AU × 150 million kilometers × 1000 meters/kilometer
≈ 1.8 × 10^14 meters

v = √(2 × (6.67430 × 10^-11 m^3 kg^-1 s^-2) × (1.989 × 10^30 kg) / (1.8 × 10^14 meters))
≈ 42.1 kilometers per second

Hence, in order for a rocket to completely leave the solar system, starting from Earth's orbit, it would need to reach a speed of approximately 42.1 kilometers per second.