In the most common use case, for the package to be reachable as a versioned dependency, its Package.swift must be at the root of a Git repository. In those circumstances, anything outside the package root is also outside the repository root and will not travel with the versioned checkout. Since it would appear to work during testing, but would never work once deployed, it is disallowed from the outset to prevent confusion.
In local arrangements that aren’t versioned anyway, you can instead make that target its own package, and then depend on it with .package(name: "Foo", path: "../..").