ASME VIII and the over-arching Canadian pressure vessel document CSA B51 give definitions for what is a pressure vessel and what isn't. Depending on the nature of the hazard represented by the fluid, the pressure and the diameter, the flowcharts given in B51 will tell you whether the component in question is a pressure vessel, a Category H fitting (for components to be fabricated and sold in multiples as discrete devices), or merely an enlargement in the pressure piping associated with other pressure vessels in the system.
Note also that there are provincial acts which exempt specific situations to ensure that devices such as domestic water heaters and water system expansion tanks are exempt.
The dividing line between vessels and pipe becomes gray as illustrated below:
Let's say we have a piece of 8" pipe connecting two large pressure vessels in a process plant. That would generally be considered a piece of ASME B31.3 piping, even though it is greater than 6" ID and greater than 1.5 cubic feet in volume, and the relief pressure is above 15 psig.
Now let's say that the pipe has a reducer at each end to 4" linesize. Still a piece of pipe, right?
Now let's say that it has reducers at either end to 1/2" NPT or a 1/2" flange, or a Swagelok connector for 1/4" OD tubing. Is this still a piece of pipe? Most people, presented with this piece of "pipe", would conclude it is an ASME VIII vessel, even though it is still no more than an assemblage of piping components.
Even though the codes don't state it in words, what they're concerned about is the volume of stored energy or hazardous material under pressure. The principal enclosures with the largest stored volumes of materials are considered vessels and subject to the rules and codes as vessels, where the lines interconnecting these are considered pipe and subject to the rules and codes associated with pressure piping.